Questions tagged [qtablewidget]

QTableWidget is a Qt class providing an item-based table view with a default model.

Table widgets provide standard table display facilities for applications. The items in a QTableWidget are provided by QTableWidgetItem.

If you need to use your own data model, then QTableView is preferrable.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

1192 questions
9
votes
2 answers

Qt - How to associate data with QTableWidgetItem?

I want to associate additional data with each QTableWidgetItem inserted into the table, in order to use that data in future, when it is being clicked on a table item. But that data should not be visible. How can I do that?
Narek
  • 38,779
  • 79
  • 233
  • 389
9
votes
4 answers

QTableWidget memory leak or not?

Suppose I have a 2D array full of data say 10 x 10. The contents, as well as a number of rows, can change any time. Now I want to display this data in a QTableWidget. I use a timer with time out 1sec to refresh the table contents. In the timeout…
Anjanu
  • 623
  • 2
  • 8
  • 19
9
votes
5 answers

QTableWidget: How can I get tighter lines with less vertical spacing padding?

The QTableWdiget is fabulous for simple grid displays. Changing colors, fonts, etc is straightforward. However, I did not manage to give the grid a 'tighter' look with less vertical whitespace. I see that the Qt documentation talks (eg here)…
Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
9
votes
3 answers

Hide the border of the selected cell in qtablewidget in pyqt?

Is there a way i can hide the border of the selected cell(or make the border color as white)in a qtablewidget.. By default a border with dotted line is shown.. Can u help me...
Jeba
  • 963
  • 4
  • 12
  • 25
8
votes
4 answers

Qt - QIcon in QTableWidget cell

I have tried numerous ways to display a QIcon in a QTableWidget cell and I am not sure why it is not working. I have a button that when pressed adds a row to the table. Here is the code... void MainWindow::pressed() { QTableWidgetItem *item =…
linsek
  • 3,334
  • 9
  • 42
  • 55
8
votes
1 answer

Adjust the size (width/height) of a custom QTableWidget

I need a QTableWidget based on a QTabelModel and QTableView with some buttons added above the table. See the following figure: The width of the QTableWidget should be adjusted so that it is not smaller than a reasonable minimum and not extend…
AlQuemist
  • 1,110
  • 3
  • 12
  • 22
8
votes
1 answer

Remove scrollbar to show full table

I have a scrollview to which I dynamically add QTableWidgets. However, the QTables themselves also have scrollbars and therefore don't show the full table. Is there a way to disable the scroll bar so that the table always gets shown in full? EDIT:…
chrise
  • 4,039
  • 3
  • 39
  • 74
8
votes
1 answer

QTableWidget auto stretch last field just like QTreeWidget does

Is there anyway to let QTableWidget's header items stretch to full size just like QTreeWidget does ?
daisy
  • 22,498
  • 29
  • 129
  • 265
7
votes
1 answer

How to hide a row of a QTableWidget without changing the index of the entries?

I have a QTableWidget with 7 colums in a QDialog, where every row has information about files in a specific directory. With some checkboxes, lineedits etc I want to have the possibility to show only those files with a certain text, which I can…
erniberni
  • 313
  • 5
  • 17
7
votes
2 answers

How to keep header from being selected when there is one item in a QTableWidget?

I can't seem to keep the horizontal header from being selected when I select a single row in a QTableWidget. Example: How can I prevent the header from being selected too? This only happens when one row is in the table. If it has more than two…
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
7
votes
5 answers

How to highlight the entire row on mouse hover in QTableWidget: Qt5

I want to highlight the row on mouse hover in my QTableWidget. When I hover the mouse, only single cell highlighted. I have tried this approach : bool MyTabWidget::eventFilter(QObject *target, QEvent *event) { if( target == ui->MyTableWidget ) …
AB Bolim
  • 1,997
  • 2
  • 23
  • 47
7
votes
7 answers

Qt QTableWidget Column resizing

I have a MainWindow with a QToolbar, QWidget and a QTabWidget. The layout is "Grid". However, my window is resizeable and since I have a layout it works well. But there is one problem, in my QTabWidget I have a QTableWidget with two columns (layout…
7
votes
2 answers

Set column width for QTableWidget in designtime

I cannot find any information for the following question: is there a possibility to set width to columns for QTableWidget in designtime. When I opened ui-file in text editor, I found, that columns are declared like this:
borisbn
  • 4,988
  • 25
  • 42
7
votes
2 answers

Retrieving cell data from a selected cell in a tablewidget

I am making a stock control program and i have hit a problem with getting the value of a selected cell, i know i need to use "QtGui.QTableWidget.currentRow" and "QtGui.QTableWidget.currentColumn" to get the item's position. However i cannot seem to…
Sam McKay
  • 73
  • 1
  • 1
  • 9
7
votes
1 answer

PyQt : Checkbox in QTableWidget

I use following code to put a checkbox in the 9th column of my QTableWidget chkBoxItem = QtGui.QTableWidgetItem() chkBoxItem.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled) chkBoxItem.setCheckState(QtCore.Qt.Unchecked) …
4oxer
  • 225
  • 1
  • 4
  • 6
1 2
3
79 80