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

writing a QTableWidget to a .csv or .xls

Is it possible to write the contents of a QTableWidget to a csv? I found a question about writing to an .xls using xlwt, but can't seem to get it to work using my code. def saveFile(self): filename =…
Victoria Price
  • 637
  • 3
  • 13
  • 26
3
votes
1 answer

how to translate string added dynamicaly in Qapp with Qtranslator?

i trying to created a Qt application multilanguage with Qt linguist. I place this code in an function of my MainWindow : translator.load(":/lang/English"); qApp->installTranslator(&translator); ui->retranslateUi(this); With the QTranslator declare…
Gat
  • 115
  • 3
  • 11
2
votes
1 answer

Group QRadioButtons in rows from a QTableWidget

I would like to create a window in Qt that contains a QTableWidget composed of 4 columns, one of text and the last 3 are QRadioButtons. I was able to create this: However, I am unable to group the QRadioButtons by row. Indeed, with this current UI,…
Benoit Duffez
  • 11,839
  • 12
  • 77
  • 125
2
votes
1 answer

Qt Model-View data and model in separate thread

Previously, I asked about running model and view in different threads and now, I understand how it poses a problem. To circumvent the problem, I was thinking of duplication of data. When data is modified by the worker thread, it simultaneously sends…
shiv chawla
  • 591
  • 1
  • 8
  • 20
2
votes
1 answer

QMenu for QTableWidget in PySide/PyQt

here is my question details: I have these widgets - QMenuBar, QTableWidget and QToolbar. Here is my code sample: import sys from PySide import QtGui class Example(QtGui.QMainWindow): def __init__(self): super(Example, self).__init__() …
SaulTigh
  • 913
  • 2
  • 14
  • 27
2
votes
2 answers

Move row up and down in PyQT4

Consider a QTableWidget and two buttons "move up" and "move down". Clicking on move up, the current row should move up one row, analogously for "move down". What's the easiest way to implement the corresponding move up and move down functions?
student
  • 1,636
  • 3
  • 29
  • 53
2
votes
2 answers

Why does Qt add more than three columns when I use restoreState() on a QTableWidget?

My code looks somehow like the following: table = QTableWidget() table.horizontalHeader().restoreState(settings.value("savedState")) table.setColumnCount(3) settings.setValue("savedState", table.horizontalHeader().saveState()) If I run it the…
Georg Schölly
  • 124,188
  • 49
  • 220
  • 267
2
votes
3 answers

Crash in Deleting selected items from QTablewidget

I have a QTablewidget with the following settings tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); I am trying to delete the user selected rows and use the…
user1146783
  • 21
  • 1
  • 2
2
votes
2 answers

QTableWidget how to have a cell selected for editing from code and/or with single click

Two part question: I have a 10x10 QTableWidget with QTableWidgetItem in each cell. For some reason, clicking on a cell is not sufficient to edit it, I need to double-click the cell to enter it. Is there a way to change this behavior to single…
storm_to
  • 1,495
  • 2
  • 16
  • 24
2
votes
0 answers

QTableWidget - setCellWidget

I try to insert a custom widget into a QTableWidget using the setCellWidget function void QTableWidget::setCellWidget ( int row, int column, QWidget * widget ) My problem is now, that the paint method of the custom widget isn't called. Anyone knows…
2
votes
0 answers

How to make a row selection in a table with a Qt widget in a cell

In my Windows C++ application, I am creating a table of type QTableWidget. The first visible cell in each row is the checkbox. The problem is that if there is a widget in a cell, I cannot highlight the entire row when clicking on any cell. All cells…
joe_dowson
  • 35
  • 5
2
votes
2 answers

QT, QTableWidget: Changing Items with the cellChanged()-signal

I am using a QTableWidget. On the cellChanged()-signal I add or update a row in a sqlite database. After executing my SQL statements i want to add a button/CellWidget to an item in this row. As this is the change of a cell, it, of course, changes…
madc
  • 1,674
  • 2
  • 26
  • 41
2
votes
1 answer

How to export QTableWidget data to Excel using Pandas?

I'm trying to pass data from a QTableWidget to Excel. Why in Excel is only the last row of the table written? (In print, the complete table is shown). rowCount = self.QTableWidget.rowCount() columnCount = 5 for row in range(rowCount): rowData =…
Fernando
  • 47
  • 5
2
votes
2 answers

Drag and drop files to QTableWidget

I'm trying to drag and drop files into a table-widget, but the path will not appear when I drop the files. When I test by using print() the path appears, but the path will not appear in the table. I am not sure why this is happening, I would greatly…
2
votes
2 answers

Add a String as an Item to a tableWidget in QT/Python

I have an array with strings and I want to add each string in a different row and the same column of a tableWidget. I'm using the function setItem to change the desired field, but I get the error QTableWidget.setItem(int, int, QTableWidgetItem):…
DeeRose
  • 21
  • 1
  • 2