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
3 answers

Qt - can QTable have column labels rotated by 90 degrees?

I have many narrow columns with very long labels. I want to rotate the labels by 90 degrees. Is it possible?
danatel
  • 4,844
  • 11
  • 48
  • 62
3
votes
2 answers

How to set cell border and background color in QTableWidgetItem?

I have a QTableWidget with 3 columns. 2 of the columns have some text in them, but one of them is empty and I want it to have a background color. Also I want the cells to have borders. If I do int i = 0; foreach (tableData el, data) { //setting…
N Alex
  • 1,014
  • 2
  • 18
  • 29
3
votes
1 answer

How to select a QTableWidget cell containing a button

I have a question regarding QTableWidget at PyQt4. Say I have a QTableWidget, where I want to have an event connected to a cell click using: table.cellClicked.connect(cellClick) then, cellClick function does its job. The thing is: some cells…
matt_1
  • 81
  • 3
  • 8
3
votes
0 answers

QAction shortcut keys not working

i am adding QAction to QTableWidget as m_pCutAction = new QAction( "Cut",this ); m_pCutAction->setIcon(QIcon(":/Img/cut.png")); m_pCutAction->setShortcut(Qt::CTRL + Qt::Key_X); connect(m_pCutAction, SIGNAL(triggered()), this,…
Wagmare
  • 1,354
  • 1
  • 24
  • 58
3
votes
1 answer

Drag and Dropping Rows between two separate QTableWidgets

Background: I have two separate QTableWidgets on my Main Window. Both of which are dynamically added in python. I have implemented pyqt code, which can be found under three_pineapples solution here. My Problem I want to be able to drag and drop…
sudobangbang
  • 1,406
  • 10
  • 32
  • 55
3
votes
1 answer

QTabWidget: determine pages to be QTableWidget

MainWindow of my Qt application has QTabWidget, where each tab is a QTableWidget. I need to get access to the selected cell of a current table (with currentRow() and currentColumn()). But when I'm taking pointer to the table with…
Tami
  • 153
  • 2
  • 2
  • 11
3
votes
1 answer

sort a column with setCellWidget in QTableWidget

I am trying to sort a column which has progressbar in it. I want column to be sorted by progressbar value. Any help will be much appreciated from PyQt4.QtCore import * from PyQt4.QtGui import * import sys class Example(QMainWindow): def…
django
  • 2,809
  • 5
  • 47
  • 80
3
votes
1 answer

Drawing line render issue in a QTableWidgetItem

I would like to draw a line inside QTableWidgetItem. To draw the line I have reimplemented the QStyledItemDelegate::paint method. But, when I'm scrolling or selecting an item in the QTableWidget. Some of the items loose their drawing effect. Here's…
Simon
  • 1,522
  • 2
  • 12
  • 24
3
votes
2 answers

Resizing a cell's height and Witdth and loading an image in QTableWidget

I want to make a 8*8 table with square cells ( a chess board ). Now I have the code to make the table but don't know how to resize the cells to be square shaped. I also want to put pictures of pieces into the cells. How should I do these? here is…
Omid
  • 5,823
  • 4
  • 41
  • 50
3
votes
1 answer

Qt Problems Adding Table Widget Items

I have an invoice form which i am using to both create invoices and display the results of a stored invoice. I when i am trying to read back data from the database and display it i am getting the error of QTableWidget: cannot insert an item that…
Root0x
  • 472
  • 1
  • 9
  • 28
3
votes
2 answers

C++ QT: QTableWidget; how to let the user select text in a cell but not edit it

I am using a QTableWidget and I have a requirement that the user is able to highlight specific text in a cell, but the cell contents should not change if the user accidentally erases or modifies some cell contents. I was thinking that the simplest…
officialhopsof
  • 173
  • 2
  • 9
3
votes
2 answers

Inserting Images from directory in QTableWidget

Well, hi all. I've got a question. I have a QTableWidget where I need put images from directory and retrieve name of image that was in selected cell. How can it automatically generate number of rows and columns depending of number of files in…
Azraith Sherkhan
  • 131
  • 2
  • 11
3
votes
1 answer

QtableWidget does not show data

I have a class that creates random data which I would like to show in a tableview on the main window. I added via Designer a table view to the main window and called it tblData. I suspect the problem is related to this because when I call the…
RogerWilco77
  • 319
  • 1
  • 3
  • 13
3
votes
0 answers

Limit data types to be inserted into a QTableWidget using PyQt4

I want to build a QTableWidget of 3 columns that can be edited in place by the user with the following scheme: First column: string Second column: float Third column: integer I would like to avoid the user to insert data types different to what I…
3
votes
1 answer

Placeholder in the QTableWidget

It is possible to set a placeholder for cell? I think it can implement by set QLineEdit for particular cell, but may be QTableWidget, or QTableWidgetItem can do this without custom widgets?
kaa
  • 1,265
  • 5
  • 22
  • 39