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

Qt setHorizontalHeaderLabels for tableWidget

How would I go about using the setHorizontalHeaderLabels property of my tableWidget to specify names for my columns as opposed to numbers? I want to keep my rows as numbers, but change my columns to names I have collected into a QList. Right now, I…
THE DOCTOR
  • 4,399
  • 10
  • 43
  • 64
6
votes
3 answers

How to word wrap text in the rows and columns of a QTableWidget?

I tried: QTableWidget *j = new QTableWidget (10000, 5, centralWidget); j->setColumnWidth (0, 500); j->setColumnWidth (1, 30); j->setColumnWidth (2, 30); j->setColumnWidth (3, 320); j->setColumnWidth (4, 310); …
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
6
votes
2 answers

How to change the background color of the QTableWidget's vertical header?

I would like to change the colors of a QTableWidget. I am almost getting the result I like, but two areas in the vertical header remain white: Before writing this post I actually managed to color also the upper left corner, but not the other area.…
JoeCool
  • 129
  • 7
6
votes
0 answers

pyqt - QTableWidget header clicked for unique column

I have a QTableWidget of 5 columns with horizontal headers. I need to launch a function when header of column 4 is clicked. Currently, I have a working solution that consists of calling this function for every header clicked and then parsing the…
Kevin Lemaire
  • 949
  • 2
  • 12
  • 36
6
votes
1 answer

How to sort QTableWidget column values?

I want to sort values in specific column by using python code when I click th "Çiz" button right side. However it sorts according to first element if numbers are double or more. I realize that it accepts values as string. I look many questions in…
Mustafa Uçar
  • 442
  • 1
  • 6
  • 18
6
votes
2 answers

QTableWidget, centering cellWidgets

Is there a way to place QCheckBox as a cell widget of QTableWidget in the center of a cell, not at the left side, without additional QWidget and adding the checkbox to it's layout?
6
votes
1 answer

QTableWidget display certain decimals like excel

My question is about the way the QTableWidget displays the cell values. I'd like for the cell to show only three decimals when it's not being edited and show the full value when you double click for editing. I am doing calculations in background…
dre
  • 173
  • 3
  • 18
6
votes
3 answers

Add border under column headers in QTableWidget

I have a table widget with two column header in a dialog that looks like this: There is a separation between the column headers named "Index" and "Label", but there is no separating border between these header and the row below them. How can this…
pbreach
  • 16,049
  • 27
  • 82
  • 120
6
votes
4 answers

Get previous value of QComboBox, which is in a QTableWidget, when the value is changed

Say I have a QTableWidget and in each row there is a QComboBox and a QSpinBox. Consider that I store their values is a QMap theMap; When comboBoxes value or spin boxes value is being changed I want to…
Narek
  • 38,779
  • 79
  • 233
  • 389
6
votes
1 answer

Resize Column Width QTableWidget

I have this widget created with QTableWidget: and I would like that the column of my table resize in order to occupy the entire width of the widget, while for the rows is ok as it is. I know there is a similar question like mine but I was not able…
ayasha
  • 1,221
  • 5
  • 27
  • 46
6
votes
1 answer

Row and column from "Itemchanged" signal

I'm working with the "itemchanged" signal. How can I find out the row and column where the item was changed? I only found the same question for c++, but I'm using python.
Hubschr
  • 1,285
  • 6
  • 18
  • 35
6
votes
1 answer

PyQt: TableWidget deselect all?

So, I'm using Python with PyQt and I have a QTableWidget. What I want to do is to, at some point, deselect everything in the QTableWidget. Is there a simple way to do that? I mean, there is a select_all option, but I can't find anything to deselect…
Antoni4040
  • 2,297
  • 11
  • 44
  • 56
6
votes
2 answers

get cell value based on header string and selected row

For example, I have a PyQt QTableWidget which has 3 columns and 2 rows. The column headers are labeled A, B, and C. A B C 1 2 3 4 5 6 This is the excerpt from my current source: class myform(QtGui.QMainWindow): def __init__(self,…
panofish
  • 7,578
  • 13
  • 55
  • 96
6
votes
3 answers

Align checkable items in qTableWidget

In tableWidget I have one column entirely made up of checkable items. I can't figure out how to center the checkbox or at least remove the text-box next to it. As you can see on this picture text-box has that ugly outline when I click on cell, I…
Aleksandar
  • 3,541
  • 4
  • 34
  • 57
6
votes
2 answers

PyQt: Search Item QTableWidget and take it's coordinates?

So, I'm using Python and PyQt and I have created a QTableWidget which I populate with data. Is there a way to search for a specific value and if the program finds something, can it return the coordinated(index) of the item? Update: Here's the…
Antoni4040
  • 2,297
  • 11
  • 44
  • 56