PDA

View Full Version : getting the value from a QTableWidget where the cell is a combobox



miguel_mark
2nd December 2008, 09:28
Hi, im having trouble in getting the value of the cell where the cell is a combobox, i've addded the combobx feature by means of:



QComboBox *cb = new QComboBox();
cb->addItem("India");
cb->addItem("Philippines");
cb->addItem("NIS");
CheckList->setCellWidget(CheckList->rowCount()-1, 3,cb);


where i already have a tablewidget and edited the cell so that it would be a combobx, but
the problem is i cannot get the value that the combobx contains on runtime.

jpn
2nd December 2008, 19:33
Cell widgets are not that strictly part of the model-view concept. Cell widgets are just something laid on top of the view. A cell value won't reflect to the value of a cell widget and vice versa. See the Spinbox Delegate example (http://doc.trolltech.com/4.4/itemviews-spinboxdelegate.html) for details how to use a custom delegate to create custom editors that are properly integrated to the model-view.