Questions tagged [qtablewidgetitem]

QTableWidgetItem is a Qt class providing an item for use with the QTableWidget class.

Table items are used to hold pieces of information for table widgets. Items usually contain text, icons, or checkboxes.

The QTableWidgetItem class is a convenience class that replaces the QTableItem class in Qt 3. It provides an item for use with the QTableWidget class.

Top-level items are constructed without a parent then inserted at the position specified by a pair of row and column numbers:

QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(pow(row, column+1)));
tableWidget->setItem(row, column, newItem);
212 questions
1
vote
1 answer

How does sibling or siblingAtRow() function works to retrieve the value from hidden Column in QTableWidget?

I have a database from which data is coming into a QTableWidget. The table in the database has the following Columns, ID (Primary key, auto-increment value) Name Location The QTableWidget has the following columns (that I have added) ID (this…
Awais Shahid
  • 117
  • 4
  • 15
1
vote
1 answer

Cannot populate QTableWidget using .setItem(row, colum, QTableWidgetItem(data))

I wanted to test PyQt to write a quick app to display and edit data in an Excel like form but the data is never shown. Both the docs and the book I read say that using .setItem(row, colum, QTableWidgetItem(data)) on a QtableWidget object is one way…
Alazeth
  • 13
  • 3
1
vote
1 answer

Modify QTableWidgetItem context menu when editing

I'm trying to add actions to the context menu that pops up when I right click while editing a cell’s content in a QTableWidget. I tried redefining the contextMenuEvent() method from QTableWidget but it is never called in this context. I also tried…
Damia
  • 141
  • 1
  • 9
1
vote
1 answer

Is there a way to display integer data inside a QTableWidget as hexadecimal?

I have a class that inherits from QTableWidget called InsnTable and one of its columns has integral data... I want to display the integers as 32-bit hexadecimal values. Is there an easy way to do so? I think of storing the data as QStrings instead…
Tortellini Teusday
  • 1,335
  • 1
  • 12
  • 21
1
vote
1 answer

QTableWidget: different styles in *one* QTableWidgetItem?

Is it possible to have a two-line element in a cell (QTableWidgetItem) of a QTableWidget with different styles per line? I want to have the first line bold and the second line not bold. Or can I add two QTableWidgetItems in one cell? Do a cellspan…
matthias
  • 247
  • 6
  • 17
1
vote
1 answer

QTableWidget insertRow() inserting empty rows

what I'm missing when populating table rows to avoid adding empty rows. For example if the items inserted are two, there is additional one empty row added at the top and so on: def search_watchlist_category(self) -> None: """ Get details…
B.Obilo
  • 73
  • 1
  • 7
1
vote
1 answer

Dynamically Set contents of QTableWidget from array

edited to add full GUI code in case it is relevant I am trying to generate the contents of a QTableWidget from a numpy array. This code runs, but the values are not showing up in the cells, and I can't figure out why. Can any experts help? I am a…
K. Mather
  • 93
  • 1
  • 7
1
vote
1 answer

The QTableWiget::cellChanged signal is not emitted for cells with a QTableWidgetItem

I have the following code, creating a table with two cells: QTableWidget table(2, 1); QObject::connect(&table, &QTableWidget::cellChanged, [](int column, int row) { qDebug() << column << row; }); auto item = new…
Blackhole
  • 20,129
  • 7
  • 70
  • 68
1
vote
0 answers

How to format cells in a QTableWidget

my problem is not so simple for me, because I'm a niewbie in qt, so asking to the experts: the problem, I populate dynamically a QTableWidget from a button on a toolbar, selecting data from a *.csv file. All works fine but the formatting of the…
Silenzio76
  • 53
  • 7
1
vote
1 answer

How to create a dictionary from QtableWidgetItem?

i'm retrieving my data from a CSV file into a QtableWidget, i created some methods to modify, delete, insert column and rows even new items... in the QtableWidget, so before going to the next step i need to convert the current QtableWidgetItem into…
1
vote
1 answer

Show the sum for multiple items

I've a data dictionary, I want to pickup some items for exemple at the 2nd range, from different lists as value of dictionary every key start with 111####, I created this method but how, I can get the sum off all items and insert it at QTableWidget…
1
vote
1 answer

Pyqt5: QtableWidgetItem "None"

I have created a table in PyQt5 and and retrieve the data in the cell by this method. But when i try the cell in QTableWidgetItem becomes None. So, how i can solve this problem and how i can insert other determined items in a specifice cell for…
1
vote
1 answer

How to fix QTableWidget setText/setCellWidget causing crash when loading QSettings

Hello I'm using a QTableWidget and essentially have code such that the first column will allow the table to grow/shrink dynamically. The last populated row's first cell will have a Plus button to add a new row that can be edited and the Minus button…
Blanky
  • 63
  • 9
1
vote
1 answer

Why QTableWidgetItem doesn't keep updating it's color?

I have a QTableWidget in my program. I want it's rows and columns to change color according to the time entry in the table widget. When I first add the time, it's compared to current system time and the color changing does take effect but as time…
Elham Khan
  • 71
  • 8
1
vote
1 answer

pyqt5 "QTableWidget" and "setItem" issue

I want to use QTableWidgetItem but something wrong.. I think the algorithm is as follows. push bottom("apply") -> change Table widget items (But nothing change...) here my python code... Please pay attention to the comments. # -*- coding: utf-8…
CGBCSH
  • 53
  • 1
  • 5