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

pyqt how to swap text in

I have a QTable Widget of one column populated with several rows, and I would like to be able to drag and drop so i can re order them. I am able to do setDragDropMode with Internal Move, but when i move cell (0,1) to (0,3) the (0,3) get the text…
pelos
  • 1,744
  • 4
  • 24
  • 34
0
votes
1 answer

QTableWidget change selection mode

When clicking on QTableWidget cell, it selects only the cell. How to configure tablewidget, so that when click on a cell , the whole row will be selected which contains the cell? It can be done using signal,slots. I'm curious is there standard way…
Ashot
  • 10,807
  • 14
  • 66
  • 117
0
votes
1 answer

Relative re-sizing of QTableWidget's columns

I am using a QTableWidget with 4-5 columns in a dialog. The dialog is resizable, I want table widget columns to resize according to dialog size i.e. if I increase dialog width, columns which are initially set with large width should expand more than…
Anwar Shaikh
  • 1,591
  • 3
  • 22
  • 43
0
votes
2 answers

How to make selected QTableWidget row bold in pyqt

I want to know is it possible to make a stylesheet to make the contents in selected row bold. i am using self.tw.setSelectionBehavior(QAbstractItemView.SelectRows) to set table to select entire row instead of cell. But i dont want any backgroung…
Rao
  • 2,902
  • 14
  • 52
  • 70
0
votes
1 answer

QTableWidget::row() not behaving as expected

When calling QTableWidget::row( const QTableWidgetItem * item ) with a pointer to a valid vertical header item, the function is returning -1. I wouldn't expect this though, since I explicitly set the vertical header item of the row in the table…
Freedom_Ben
  • 11,247
  • 10
  • 69
  • 89
0
votes
1 answer

C++ Qt QTableWidgetItem causes crash

I have a QTableWidget called tw_topic. It's not empty. In another function I need the text of the items. Code : for(int i = ui->tw_topic->rowCount(); i >= 0; i--) { //should return the first item of the first column const QString itm =…
0
votes
1 answer

Cannot insert an item that is already owned by another QTableWidget

I'm having issues with QTableWidgetTable, after I run the FindTableItems function it resets the rows/number to the appropriate size, but does not put any data into the cells. I can see that the objects are holding the correct data. I recieve no…
rreeves
  • 2,408
  • 6
  • 39
  • 53
0
votes
1 answer

QTableWidget hangs/pauses when not in focus

I currently have a qtable widget that gets update 100s of times a sec. It seems to be working fine however I have noticed that after a while the updated values are not displayed until you move the scrollbar a little.Any suggestions on what might be…
MistyD
  • 16,373
  • 40
  • 138
  • 240
0
votes
1 answer

TableWidget does not show updated value of an item

I was experimenting with the following code QTableWidgetItem* item_a= new QTableWidgetItem("1"); QTableWidgetItem* item_b= new QTableWidgetItem("2"); QTableWidgetItem* item_c= new QTableWidgetItem("3"); ui.tableWidget->setItem(0,0,item_a);…
MistyD
  • 16,373
  • 40
  • 138
  • 240
0
votes
2 answers

Primary Key in QtableWidget - If row exists update otherwise Add

Being new to Qt. I wanted to know if there was a way to add a primary key in a QtableWidget.The reason I want to do this is because I want to create a mechanism so that if I add a row with a key that is not in the table it gets added as a new row…
MistyD
  • 16,373
  • 40
  • 138
  • 240
0
votes
1 answer

Selecting text in qTableWidget cell

I have a QTableWidget with data. At runtime i am adding row and inserting default data (header names) in cells. User will be filling the data by removing default data. So i want to make it easy for end user. So thought of selecting the first cell in…
Rao
  • 2,902
  • 14
  • 52
  • 70
0
votes
1 answer

Qt Error request for member 'rowCount' in 'a', which is of non-class type 'QTableWidget*'

Code : void MainWindow::add_test(QTableWidget* &a, QTableWidgetItem* &i1, QTableWidgetItem* &i2){ int row = a.rowCount(); a.setItem(row,0,i1); a.setItem(row,1,i2); } Now I get these errors : error: request for member 'rowCount' in…
0
votes
1 answer

Qt4 SegmentationFault on QTableWidget::setItem

I have a very strange problem here. My program is SegmentationFault when I'm setting item to a table. Here is my code. Header: class Program : public QMainWindow { Q_OBJECT public: Program(); private: QTableWidget…
Marcus
  • 1,685
  • 1
  • 18
  • 33
0
votes
1 answer

QTable Widget Column 0 (zero) not updating

Hi i Have a QTable widget in window. The column data will be updating pragmatically. Currently all are working fine but index 0 column is not refreshing on data update (if i click table widget or re-size window its updating). But other columns are…
Rao
  • 2,902
  • 14
  • 52
  • 70
0
votes
1 answer

Problems with all the windows opening separately in QT4

I am new to QT, right now am trying to place a Table below a QList, but the Qlist and the table are showing as two separate window. I need the output more or less like itunes with the Qlist on top and a Qtable at the bottom. Any Help is Appreciated.…