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
6
votes
2 answers

Getting Header Column on Right Click for QTableWidget

I have a QTableWidget with a number of columns that are only checkboxes (and some that aren't). I am trying to implement a feature so that when the user right clicks on a header item related to a "checkbox only" column, they are presented with the…
wklumpen
  • 81
  • 2
  • 6
5
votes
1 answer

How to limit the selection in a QTableWidget

How would I go about limiting the rows/columns selected in a QTableWidget? I need to force the user to use a contiguous selection (already done) to select exactly two columns and any amount of rows. Thanks!
Sam Bloomberg
  • 705
  • 1
  • 6
  • 23
5
votes
2 answers

Qt widget resizes to width=256, while it shouldn't

Form setup: QSplitter (highlighted on the image) that contains QTreeWidget (left) and QTableWidget (right): Non-default properties of these two widgets within QSplitter: QTreeWidget minimumSize / Width = 150 QTableWidget minimumSize / Width =…
Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95
5
votes
1 answer

Sort vertical headers of QTableWidget

I have a QTableWidget that is used to display lots of data, basically derived from a function f(a,b). All a values go into the horizontal header, all b values into the vertical header and all f(a,b) into the corresponding cell. The columns should be…
Sebastian Negraszus
  • 11,915
  • 7
  • 43
  • 70
5
votes
1 answer

How to align all items in a column to center in QTableWidget

I am using PyQt5 and using PyCharm. How can I align all cells under one column to center? The code below seems to be working but for only one cell which is the header. What should I change or add? item3 = QtWidgets.QTableWidgetItem('Item…
5
votes
2 answers

How to show the row where QPushButton is clicked in QTableWidget

I would like to delete row where QPushButton is clicked how it is possible to I think it is reasonable to use slots but how to do it don't know , if you have any ideas how to get a row of selected button please share, thanks. It is my table It is a…
user8167852
5
votes
3 answers

How can I remove the "padding" of a QTabWidget?

I have a QTabWidget with a QTableWidget inside, as the example below: But it has a "padding" (at least I think it is a padding) in the QTabWidget (marked as red in the figure). How can I remove that or expand the QTableWidget to fill the…
KelvinS
  • 2,870
  • 8
  • 34
  • 67
5
votes
2 answers

Detect click and get text of QTableWidget header, how?

I see how to detect click in a QTableWidget cell by watching the cellClicked(int row, int column) signal (code below). I would like to do the same for the cells of the horizontal header and get the text of the clicked header cell. How do I do…
KcFnMi
  • 5,516
  • 10
  • 62
  • 136
5
votes
4 answers

How to catch key presses in editable QTableWidgetItem?

Now I can process all key presses in my QTableWidget in a function eventFilter() (after calling of myTable->viewport()->installEventFilter(this); in the constructor). The only place where this doesn't work is editable cell while editing (because it…
Ilya
  • 4,583
  • 4
  • 26
  • 51
5
votes
2 answers

Qt Table widget. How to set the meaning/title for vertical header and horizontal header together?

I know how to set text labels into row or column headers. But I want to do something like this: https://i.stack.imgur.com/eMM6U.jpg I don't find any info on how to do the thing inside the red circumference. I'm starting to believe this can't be done…
Jorge C
  • 53
  • 4
5
votes
4 answers

Reading selected Items from QTableWidget

How can read selected items from QTableWidget? Thanks
ayla
  • 377
  • 4
  • 7
  • 14
5
votes
3 answers

QTableWidget signal cellChanged(): distinguish between user input and change by routines

i am using PyQt but my question is a general Qt one: I have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal…
crabman
  • 51
  • 1
  • 3
5
votes
1 answer

Spanning horizontal header in Qt

I want to merge(span) horizontal headers in QTableWidget. I tried googling for the same, but no luck and hence posting it. Please guide me.
user3480065
  • 53
  • 1
  • 5
5
votes
1 answer

In Qt, how to resize icons in a table?

I put icons as items in a table: QTableWidget *table = new QTableWidget(this); QTableWidgetItem *item = new QTableWidgetItem; item->setSizeHint(QSize(100, 100)); item->setIcon(QIcon(fileName)); table->setItem(0, 0, item); However no matter the…
Pietro
  • 12,086
  • 26
  • 100
  • 193
5
votes
3 answers

pyqt - populating QTableWidget with csv data

I have a QTableWidget, i export the data from this table to a csv file. But now, i want to Open a existing csv file and populate my table with this data. how can i do it? This is my export code, i want a "populate" code, and i really dont know how…
Marco
  • 339
  • 2
  • 11
  • 20