qtablewidget

Qt setColumnWidth does not work.

Have written the following code: m_selectCategoryTableWidget = new QTableWidget; m_selectCategoryTableWidget->setRowCount(0); m_selectCategoryTableWidget->setColumnCount(2); m_selectCategoryTableWidget->setHorizontalHeaderLabels(QStringList()<<tr("Category")<<tr("Number of items")); m_selectCategoryTableWidget->verticalHeader()->setVis...

QComboBox and QSpinBox in QTableWidget with appropriate alignment.

How to create a QTable widget which has 2 columnes, and in first column there is a QComboBox and in the second column there is a QSpinBox so that the combo box gets all the space of table and only a very small place leaves for QSpinBox (for 2-3 digits). ...

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 update "theMap". So I should know what was the former value of the combo box in order to replace with the new value of the combo box and...

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

Hi 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 picturs of pieces into the cells. How should I do these? here is the code i have: #include <QtGui/QApplication> #include "mainwindow.h" #include <QHBoxL...

problem with replacing a background image using signal / slot in qt

Hi i want to make a simple chess program. So far i've made the board using QTableWidget and loaded the piece pictures in the cells of table. Now i wnat to use signal and slot so that when user clicks a cell and then click another cell the piece picture from first cell goes to second cell, But I don't know how to do it. Note that i don'...

How to get this QTableWidget to display items?

I have a QTableWidget and I can't get anything to show up in it. The following appears in the constructor of the main window: ui->tableWidget->setItem(0,0,new QTableWidgetItem("Item1")); ui->tableWidget->setItem(0,1,new QTableWidgetItem("Item2")); ui->tableWidget->setItem(0,2,new QTableWidgetItem("Item3")); When I run the application...

How to make QTabWidget without pages

I with to use the tabs of QTabWidget but I don't need the pages as containers. I need only the tabs. Is there a way I can hide or disable the page containers and display only the tabs? ...

How to keep header from being selected when there is one item in a QTableWidget?

I can't seem to keep the horizontal header from being selected when I select a single row in a QTableWidget. Example: How can I prevent the header from being selected too? This only happens when one row is in the table. If it has more than two rows, then it works as expected and only the row itself is selected. Note: I have set u...

PyQt: How to catch mouse-over-event of QTableWidget-headers?

Hi guys, what I want to do is to change the text of a QLable, everytime I hover with the mouse over the horizontalHeaders of my QTableWidget. How can I do that? Everytime I'm over a new header I need a signal and the index of the header. Hope someone of you has an idea. There must be a function, because if you hover over the headers, th...

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? ...

How do I get some slot/function to be executed when a certain QTableWidgetItem is checked / unchecked in PyQt

I have a dynamically created table, that has N rows and M QTableWidgetItems (that are only used as checkboxes) per row - I need to run code that knows the row and the column whenever a checkbox is checked or unchecked. My CheckBox subclass looks like: class CheckBox(QTableWidgetItem): def __init__(self): QTableWidgetItem.__...

QTableWidget Update Problem on Windows XP

I have a small Qt Dialog which contains a QTableWidget. The QTableWidget's contents show a live view of a data pool as well as being able to edit the pool's values. Now on Windows 7 everthing works just fine, unfortunately on XP the QTableWidget's contents aren't updated. This is the code used to update the item's data. tableWidget->...