qtablewidget

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 first time it there are only 3 column headers. The second time there are 6 and the third 9.....

How do I add a header with data to a QTableWidget in Qt?

Hi, I'm still learning Qt and I am indebted to the SO community for providing me with great, very timely answers to my Qt questions. Thank you. I'm quite confused on the idea of adding a header to a QTableWidget. What I'd like to do is have a table that contains information about team members. Each row for a member should contain his f...

Hide the border of the selected cell in qtablewidget in pyqt???

Hello all, Is there a way i can hide the border of the selected cell(or make the border color as white)in a qtablewidget.. By default a border with dotted line is shown.. Can u help me... ...

QT slot get Signaled twice

In QT4.5, I use a QTableWidget, and I have connected the signal QTableWidget::itemClicked() to a custom slot like this: connect(_table, SIGNAL(itemClicked(QTableWidgetItem*)), item, SLOT(sloItemClicked(QTableWidgetItem*))); I create such a connection for each row I add to the table. The problem is that the slot sloItemClicked get ca...

No such signal QTableWidget::cellChanged(int, int)

The title describes my problem quite well. The offending line of code: connect(table, SIGNAL(cellChanged(row, 5)), this, SLOT(updateSP())); I can think of no reason why that signal is not valid. I googled around, and found a couple people with the same problem, but the solutions posed there don't work. I'm using Qt 4.5.2 on Ubuntu ...

QTableWidget: How can I get tighter lines with less vertical spacing padding?

The QTableWdiget is fabulous for simple grid displays. Changing colors, fonts, etc is straightforward. However, I did not manage to give the grid a 'tighter' look with less vertical whitespace. I see that the Qt documentation talks (eg here) about margin border padding around widgets, but when I set these I only get changes aroun...

QTableWidget signal cellChanged(): distinguish between user input and change by routines

i am using PyQt but my question is a general Qt one: I have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal cellChanged() for every cell. The signal cellChanged() is connected to a function on_tableWid...

QTableWidget alignement with the borders of its parent QWidget

Let's consider we have QWidget that contains QTableWidget (only). So we want to resize the table by resizing the widget, and we dont want to have an indet between the QWidget border and cells of the table. What kind of property is making posible for QTableWidget to be aligned with the borders of it parent widget? Thanks. ...

Change table columns width on resizing window or splitter

Consider there is a QTablWidget and a QTextEdit. Both of them are in a horisontal QSplitte. Let the QTable widget has 2 columns. The problem is to resize the table columns' width as you do resize operation by moving the splitter with mouse. Are there any options to may colums to be resized synchornosly with the table? Thanks. ...

Qt How to make a column in QTableWidget read only.

I would like to have one column in QTableWidget NOT editable. I forums have read a lot about some flags bould could not manage to implement. Thanks in advance! ...

Qt - How to associate data with QTableWidgetItem?

I want to associate aditional data with each QTableWidgetItem inserted into the table, in order to use that data in future, when it is being clicked on a table item. But that data should not be visible. How can I do that? ...

How can use QTableWidget

How can I show data on QTableWidget and read from data on it with header? ...

Reading selected Items from QTablecWidget

How can read selected items from QTableWidget? Thanks ...

Showing data on QTableWidget

I have a database table and I must read it and show it on tableWidget I read it but I cant show it on tableWidget, How can I do? Thanks ...

changing cell background color in qt

hello .. i'm new to pyqt , and i'm still facing some newbie problems :D i have a QTableWidget that is item delegated on a QChoice control ( hope i said it right ) i need to have the cell background color changes whenever a user change the choice control selection briefly: how to change a cell background color in a table widget ?? i...

Which button was clicked?

How can I detect which mouse button was clicked (right or left) in the slot for QtCore.SIGNAL('cellClicked(int,int)')? ...

Positioning the child widget in QTabWidget

Hi Geeks, In Qt application , I am using a QTabWidget where its first tab points to a QWidget which is a login form. Pasting the code for login widget. #include "conn.h" #include <QVariant> #include <QAction> #include <QApplication> #include <QButtonGroup> //#include <QGridLayout> #include <QVBoxLayout> #include <QHeaderView> #include...

How to get the row number of the QComboBox in QTableWidget

Here is the code, but it dos not work. Who can create the code. Thanks very much! void add() { QComboBox *ziduan = new QComboBox; ziduan->addItem("年度","nd"); int row =0; int col =1; QSignalMapper* signalMapper = new QSignalMapper(this); connect(ziduan, SIGNAL(currentIndexChanged(int)), signalMapper, SLOT(map())); signalMapper->...

QTableWidget::itemAt() returns seemingly random items

I've just started using Qt, so please bear with me. When I use QTableWidget->getItemAt(), it returns a different item from if I used currentItemChanged and clicked the same item. I believe it's necessary to use itemAt() since I need to get the first column of whatever row was clicked. Some example code is below: MainWindow::MainWindo...

How to edit multiline text in cell of QTableWidget?

How to edit cell manually like in Excel: Alt + Enter -> line break (true break, not simply line break symbol on the same line) Enter -> exit from edit mode? EDIT: Text in one cell in view mode: Line1 Line2 Same text in edit mode: Line1 Line2 Besides, I cannot write newline in cell, I can insert it only by copying. ...