Questions tagged [qtablewidgetitem]

QTableWidgetItem is a Qt class providing an item for use with the QTableWidget class.

Table items are used to hold pieces of information for table widgets. Items usually contain text, icons, or checkboxes.

The QTableWidgetItem class is a convenience class that replaces the QTableItem class in Qt 3. It provides an item for use with the QTableWidget class.

Top-level items are constructed without a parent then inserted at the position specified by a pair of row and column numbers:

QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(pow(row, column+1)));
tableWidget->setItem(row, column, newItem);
212 questions
2
votes
1 answer

PyQt5: State change in Checkboxes from a QTableWidget

I'm wondering if there is a way to run a function whenever you check/uncheck a checkbox from a cell in a QTableWidget. Right now I create these checkboxes in the following way: for row in range(len(my_list)): self.item =…
Hiperfly
  • 168
  • 3
  • 16
2
votes
0 answers

Large Column Labels: rotate the text up to 90 degrees?

I have too large column labels as on the example belows. How Could I rotate the header labels up to 90 degrees? Have you any idea how can I do it easy way ? import sys from PyQt4.QtCore import * from PyQt4.QtGui import * data = {'Large Table…
stepBystep
  • 187
  • 1
  • 1
  • 8
2
votes
1 answer

ReadOnly row for more than one QTableWidget with class and get more efficiency

How could I rewrite that code bellow for more then one QTableWidget(not only the self.general_table) ? I don't want to put the same code for every table. class QTableWidgetEnDisabledItem(QtGui.QItemDelegate): """ Create a readOnly/editable…
stepBystep
  • 187
  • 1
  • 1
  • 8
2
votes
2 answers

How to control appearance of QTableWidget header

How to change QTableWidget header's font and its content margin and spacing? I would like to make the font for "Column 0", "Column 1" smaller and have no spacing between the name of the columns and the header edge. from PyQt4 import QtCore,…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
2
votes
1 answer

QList to QTableWidget

I'd like to paste all my data I stored in several QList variables into one central QTableWidget. I have six QList variables with actually each length of them is 7. With the help of this routine, I'd like to write each element of my QList…
jollepe
  • 71
  • 13
2
votes
1 answer

disabled qtablewidgetitem is not shown gray

i have a qtablewidgetitem and inside it there is a QCheckbox when disabling qtablewigetitem as follow flags = self.item(row+1, self.columns["USER_ACCESS"]).flags() flags |= QtCore.Qt.ItemIsSelectable flags |= QtCore.Qt.ItemIsEditable …
Elteroooo
  • 2,913
  • 3
  • 33
  • 40
2
votes
1 answer

PyQt QTableWidget retrieve edited field

I am fairly new to PyQt and I am making a GUI in PyQt4 and Python 2.7 that (among other things) controls the settings of a handful of micro-controllers. To easily populate and display the list of settings, and which controller they are from I have…
Senofa
  • 48
  • 1
  • 6
2
votes
1 answer

How to set a "plain" or "flat" background color for a QTableWidgetItem

I have a QTableWidget. I want to have alternating background colors for the rows, but I can't use QTableWidget::setAlternatingRowColors because I need one color for two rows and the other one for the next two and so on (see the below image). Thus,…
Tobias Leupold
  • 1,512
  • 1
  • 16
  • 41
2
votes
1 answer

PyQt/Pyside - also return the previous value with valueChanged

I am new to these forums. In a QTableWidget I am trying to validate the changed value of the QTableWidgetItem. If the new value is present elsewhere in the table, I need to revert the value back to the previous value. I have thought of using a…
2
votes
2 answers

How to get a Value from a Qtable

i have an editable row in my tablewidget. The values are from a .txt. My intension is it to change some Values in the widget, and then make a new .txt with the changed Values. but i dont know how to "extract" the changed Values from the…
Hubschr
  • 1,285
  • 6
  • 18
  • 35
2
votes
1 answer

How to populate Qtablewidget with editable item and none editable item

every body i have a problem in populating Qtablewidget with editable items for the first row , and then non editable items for the rest of rows her is my implementation so far #include "mainwindow.h" #include "ui_mainwindow.h" #include…
advseo32
  • 401
  • 1
  • 5
  • 15
2
votes
1 answer

Get back QWidget after using in QItemEditorCreatorBase

I have a numeric editor that extends the QSpinBox NumericEditor::NumericEditor(QWidget *widget): QSpinBox(widget) I use this editor to edit the type QVariant::Int in the QTableWidget QItemEditorCreatorBase *numericEditor = new…
1
vote
1 answer

Qt QTableWidget Header Color

I would like to change the color of a vertical header cell in a QTableWidget. Here is my (failed) attempt: QTableWidgetItem* vHeaderItem = new…
Jean-Luc
  • 3,563
  • 8
  • 40
  • 78
1
vote
1 answer

Remove unwanted padding/spacing in QTableWidget cells

I've created a QTableWidget and populated its last column with QPushButtons added inside a QButtonGroup (given in the code below): from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import sys class…
Eliazar
  • 301
  • 3
  • 13
1
vote
1 answer

QTableWidgetItem displays three dots instead of full text

I'm using a QTableWidget with four column witch i programaticaly fill with QTableWidgetItem in a loop. it's working but the full text is not displaying, it show three dots instead like there isn't enough space: if i double click on a row it will…
Brandonn
  • 11
  • 3