PDA

View Full Version : Clicking a QComboBox does not change cells in QTableWidget



ean5533
10th March 2009, 04:21
This is my first post here, so be gentle...

I have a QTableWidget that I'm populating with QComboBox's and QSpinBox's. For example...

QTableWidget *table = new QTableWidget(this);
QComboBox *cmbEx = new QComboBox(table);
table->setCellWidget->(2, 2, cmbEx);

However, now when I run the form and click on that combobox, it does not activate the cell it is in. For example, if I'm currently in cell [1,1], and I click on that combobox I created, the table does NOT change to cell [2,2] like it should -- it stays in cell [1,1]. If I use the TAB key to move into the combobox, the cell changes just fine.

Is there something I need to do to force the QTableWidget to be aware that I have clicked on the QComboBox and force it to change cells?

Thanks,
-Evan

spirit
10th March 2009, 06:21
you need to set data in table manually when data in combobox have been changed. another way it's write your own delegate. take a look at QTDIR/examples/itemviews/spinboxdelegate.

ean5533
11th March 2009, 02:00
This worked absolutely perfectly. Thanks again.