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

How do I get text from an item in a qtablewidget?

I want to highlight all of the cells in my table that have the same value in the first column, but have a different value in any other cell. So, for example, if I have two records in my table: test, 25, 15, 45 test, 25, 5, 45 I would want to…
Tim Hutchison
  • 3,483
  • 9
  • 40
  • 76
3
votes
0 answers

How to retain row height and column span attribute after sorting on QTableWidget?

I just realize that in QTableWidget, if I modify a row height or change its column span, after sorting, that information is not tied to sorted data. It ties only to that physical row index. Well, this is understandable as user is actually sorting…
swdev
  • 4,997
  • 8
  • 64
  • 106
3
votes
1 answer

Qt how to insert string inside a cell in QTableWidget

Possible duplicate: Filling some QTableWidgetItems with QString from file How to insert rows at run time in a QTableWidget? How to insert hard coded strings in the cells of this QTableWidget? Here's what I tried before getting stuck... I have…
cappy0704
  • 557
  • 2
  • 9
  • 30
3
votes
1 answer

QTableWidget Item Get Widget Type and Access It

I am attempting to sum rows in a QtableWidget and I get a segmentation fault when doing so not sure what is causing this, but I think it has something to do with the fact that I am setting the cell widget items as spinboxes and I am not accessing…
Talon06
  • 1,756
  • 3
  • 27
  • 51
3
votes
2 answers

Fitting rows in QTableView, getting rid of extra space

I'm trying to generate a simple table (2 rows and 2 columns) and write it to a pdf file, using Qt 4.8.0. So far, I generate the pdf but there is extra space at the bottom of the "printed" table: I got the same problem with the right side of the…
Adri C.S.
  • 2,909
  • 5
  • 36
  • 63
3
votes
2 answers

Qt How to check state checkbox in QtableWidget

Recently I found the way that checkbox places in the middle of QtableWidget item. However, I do not know how to check state whether or not button is clicked. Could you tell me how to check button state? here is what Ive found code: QWidget *pWidget…
Jongju Kim
  • 184
  • 2
  • 13
3
votes
1 answer

PySide/PyQt: 'TypeError: native Qt signal is not callable' when trying to use 'currentItemChanged' with QTableWidget

I have a table with some data that I want to be able to edit through the QTableWidget. Upon trying to connect the currentItemChanged signal: self.QTableWidget.currentItemChanged(QTableWidgetItem,QTableWidgetItem).connect(self.editCell) I get the…
UrbKr
  • 621
  • 2
  • 11
  • 27
3
votes
1 answer

QTableWidget Force Single Item Selection

In PyQt how can I force a QTableWidget to only accept a single section (so that you can't select more items with Shift or crtl)?
user2339945
  • 623
  • 1
  • 9
  • 14
3
votes
1 answer

QTableWidget edit only one column and leave the rest non-editable

In QT 4.7, I am trying to make one QTableWidgetItem in a QTableWidget Editable and the rest all columns should be read only for me. I am having problems here. I have checked a number of samples through google and stackoverflow but failed to achieve…
Muthu
  • 2,675
  • 4
  • 28
  • 34
3
votes
3 answers

Custom Sorting in QTableWidget

I have a QTableWidget and i am using its default sorting capability through header columns but one of my column in QTableWidget is integer type and through QTableWidget default sorting it is being sorted like a string.So there is any means by which…
kapil vermani
  • 31
  • 1
  • 1
  • 2
3
votes
1 answer

Select rows and columns in QTableWidget, while keeping highlighted

I have a QTableWidget that I've set up such that you can't select the cells, but can select rows/columns by their headers. The problem I'm having is when I select a row, it deselects any columns that were selected, and same for column/rows. I want…
mpellegr
  • 3,072
  • 3
  • 22
  • 36
3
votes
5 answers

Find out which column is selected in a QTableWidget

I have a QTableWidget with SelectionMode set to SingleSelection, and SelectionBehavior set to SelectColumns. This means that only a single column can be selected. But I later need to find out which column is selected, and the only functions I can…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
3
votes
1 answer

Widget alignment in cell pyqt

I'm developing some tool in PyQT4 and Python 2.7 and I stuck in a little problem. I've 3 buttons in stored in widget and that widget is in cell in the table (QTableWidget). So my problem is that I can't align widget to top of cell and tool doesn't…
3
votes
1 answer

QTableWidget::item() QTableWidget::cellWidget ()?

Does anyone know the relation between return value of QTableWidget::item(x, y) and QTableWidget::cellWidget (x, y) in the same QTableWidget and same row.column.?
Al2O3
  • 3,103
  • 4
  • 26
  • 52
3
votes
2 answers

Python: numerical sorting in QTableWidget

I need first column of my QTableWidget to be populated as: Row: 1, Row: 2...Row: 100 , but sorting doesn't work as expected (numerically). Sorting works fine with this code, but I don't get expected text: for i in range(0, self.rows): item =…
Aleksandar
  • 3,541
  • 4
  • 34
  • 57