问题标签 [qtablewidgetitem]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
3244 浏览

qt - 带有复选框的 QTableWidget

我需要使用QTableWidget复选框而不是项目中的文本。复选框必须位于项目的中心。

我在复选框被选中时尝试工作的示例。如果我取消选中复选框,它就会消失。

0 投票
3 回答
922 浏览

qt - 如何从 QTableWidgetCell 获取小部件

我用QCheckBoxQTableWidgetCell

我不能得到这个QCheckBox

0 投票
1 回答
515 浏览

c++ - 是否可以在另一个 QTableWidget 中添加 QTableWidget?

我有一个QTableWidget我想在字段上填充另一个QTableWidget.

这是它的样子:

我想Table B在 section 列的每个字段中添加一个,以便我更容易处理Table A(main Table) 中每个项目的每个复选框。

可能吗?有没有更好的方法来解决这个问题?

0 投票
1 回答
2781 浏览

python-3.x - PyQt5 QTableWidget 仅显示第一行和第一列

我有QTableWidget一个列表列表。每个内部列表有八个元素,我的表有一个在加载其他元素后计算的第九个控制列。我可以读取和打印来控制台表格的任何单元格的内容print(self.tAccounts.item(52,3).text()),所以我认为数据没有问题,但是表格只显示表格中第一行和第一列的单元格内容,留下其他银行. 我应该在某个地方犯了错误,但我看不到。

使用 PyQt 5 和 Python 3。

构造函数

成员函数:

0 投票
1 回答
1384 浏览

c++ - 如何将 QLabel 添加到 QTableWidgetItem?

我这样做:

但是当我单击单元格并且我无法编写文本时没有任何反应。

0 投票
2 回答
3245 浏览

c++ - 从 QTableWidget 中的目录插入图像

好吧,大家好。我有个问题。我有一个QTableWidget需要从目录中放置图像并检索所选单元格中的图像名称的位置。它如何根据目录中的文件数自动生成行数和列数?我可以手动将图像添加到表格中,但这不是我想做的。我想这一定是什么

但仍然无法弄清楚我该怎么做。

0 投票
1 回答
3151 浏览

python - 禁用的 qtablewidgetitem 未显示为灰色

我有一个qtablewidgetitem,里面有一个QCheckbox

禁用时qtablewigetitem如下

它已被禁用,我无法单击它,但它仍处于启用状态时被显示。

我想用灰色显示它

更新:

这就是我把它放在 QTableWidgetItem 中的方法

0 投票
1 回答
142 浏览

c++ - C++ Qt QTableWidget item moves when resizing column

I am writing a C++ plugin for an existing application where I need to display a window which contains a QTableWidget using Qt.

Here is an excerpt of my working code where I am building the QTableWidget and filling the cells.

It works as expected, except the data inside each successive column is moved further right than the previous column. This can be exaggerated when you resize a column and see the data in columns to the right "slide" even further right.

Here are 2 screenshots of the effect (before and after column resize). You can see how the words "cat" and "frog" have moved more to the right than normal.

enter image description here

enter image description here

What am I doing wrong? I want each cells text to be aligned to the left of each column.

0 投票
1 回答
4860 浏览

qt - QTableWidgetItem 设置隐藏数据

给定一个 QTableWidget,有没有办法为单元格(QTableWidgetItem)设置一个“隐藏”值,不同于显示的值?

例如,我的单元格应该显示“项目 1”文本,但双击它应该只在值 1 上进行编辑,显示一个默认为 1 的旋转框。换句话说,单元格显示的文本应该从创建开始与单元格关联的值(隐藏)。

我在 QTableWidgetItem 上找不到合适的 QT 函数。

0 投票
1 回答
297 浏览

qt - 调用 QTableWidgetItem::text() 时出现段错误

我在使用 QTableWidget 时遇到问题。当用户更改单元格时,我试图从 QTableWidget 获取数据。所以我正在使用

这是检查点的代码

当我调用 item->text() 并且我的应用程序崩溃时,我遇到了 segFault。我检查了 x=0 和 1-y=1。我已经检查了一些关于类似问题的帖子,这似乎是由焦点引起的。但我真的不知道在那里做什么。谢谢您的帮助。