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
5
votes
1 answer

QTableWidget column resize event

I want to know whether a column of a QTableWidget is being resized by mouse. How can I emit a signal whenever any of the columns is resized?
fatma.ekici
  • 2,787
  • 4
  • 28
  • 30
5
votes
2 answers

Qt model/view vs standard widget

I am currently reading model/view tutorial from Qt, but I am still not sure if I should use model/view or widget for my Qt program : I need to do a logger application that will monitor all information in a simulation environment. Basic scenario…
peterphonic
  • 951
  • 1
  • 19
  • 38
5
votes
3 answers

Qt - Cannot put an image in a table

Why with the following code I just get an empty table widget? QString imgPath = "C:\\path\\to\\image.jpg"; QImage *img = new QImage(imgPath); QTableWidget *thumbnailsWidget = new QTableWidget; QTableWidgetItem *thumbnail = new…
Pietro
  • 12,086
  • 26
  • 100
  • 193
5
votes
4 answers

Sorting in pyqt tablewidget

How can I sort a coloumn in pyqt by the highest number? Currently I have setSortingEnabled(True) and that only sorts it by the most numbers (ex. 1,1,1,1,2,2,2,3,3) i want to do it by the highest number for example (ex. 58,25,15,10). Thanks! Data…
user1582983
5
votes
2 answers

add custom widget to QTableWidget cell

I have custom widget made with qt designer and i want to add it to QTableWidget cell. But it doesn't work. Here is the code : int nRows =10; for(int row = 0; row < nRows;row++;) { QTableWidgetItem* item = new QTableWidgetItem(); CustomWdg*…
user152508
  • 3,053
  • 8
  • 38
  • 58
5
votes
2 answers

How to set QTableWidget background transparent in Qt?

I am developing an app in which I am using QTableWidgets, and I need to set its background transparent, I have tried to setStyleSheet "background:transparent;" from form, but nothing happened, is there any other way to do it? I am posting a…
abhishek
  • 857
  • 3
  • 13
  • 34
5
votes
1 answer

How to drag and drop into a QTableWidget? (PyQT)

I'm struggling with getting drag&drop to work. I want to be able to drag&drop from a QPushButton into a cell of a QTableView. I've looked at a few tutorials online but seem to be stuck at the first step. The example below is changed from the amazing…
David Basalla
  • 2,996
  • 3
  • 18
  • 22
5
votes
2 answers

The first time a QTableWidget is populated, everything is fine, but when i repopulate it, it's significantly slower

THE CODE: populateTable() { tableWidget->clearContents(); tableWidget->setRowCount(stringList.size()); for(int i = 0; i < stringList.size(); ++i) { tableWidget->setItem(i, 0, new QTableWidgetItem(stringList.at(i))); } } THE…
Subaru Tashiro
  • 2,166
  • 1
  • 14
  • 29
4
votes
2 answers

Python PyQt - QTableWidget, JSON, and emitSignal causing blank cells

I am using PyQt for a simple application that reads from a log file with JSON formatted strings, and outputs them nicely in a table. Everything is working as expected except when I try to emit a signal from a 'load' function. This signal is picked…
PenguinCoder
  • 4,335
  • 1
  • 26
  • 37
4
votes
1 answer

Scroll QTableWidget to specific column

I have a bunch of data in a QTableWidget and I would like to be able to scroll to a particular column. I'm currently using scrollToItem(self.item(0, col)). However, this hardcodes the row to 0. It causes problems if a user is looking at row 100…
durden2.0
  • 9,222
  • 9
  • 44
  • 57
4
votes
4 answers

How to extract content, result of selectedItems()

The code below produces a little dialog box like the one shown, where the rows of the table can be selected (CTRL key for multiple select, or toggle on/off). Then clicking the 'Ok' button, the content of the selections are available using…
gseattle
  • 986
  • 1
  • 14
  • 23
4
votes
1 answer

How to make table view corner items corners round?

I have a QTableWidget (alternatively, a QListWidget) which I want to style in the following way: The "selected" color of the cells should be a certain fixed color. I am able to do this by using the following stylesheet: QTableWidget::item:selected…
Borage
  • 43
  • 3
4
votes
2 answers

How do I assign a border to a specific QTableWidgetItem or a row in a QTableWidget?

I am trying to make certain cells in my QTableWidget have different colored borders based on the information contained in an item(cell). I do not want to select those cells and use the selection-color styles because different cells need to be…
Brian
  • 41
  • 1
  • 2
4
votes
1 answer

QtDesigner & PySide: QTableWidget don't get accessible

I made a form in QtDesigner. This form gets loaded from PySide with help of the function widget = loader.load(file, parent) However, the QTableWidget (with objectNname buffer_table) don't get accessible with widget.buffer_table If I use a…
AkaBkn
  • 175
  • 1
  • 1
  • 7
4
votes
1 answer

How to change the height of a horizontalHeader (QTableWidget)

I have a QTableWidget and I want to change the size of the horizontalHeaders. But there is only a function to set the width. But how do you change the height? Hope someone can help me.
user427305
  • 131
  • 1
  • 6
  • 12