Hi all;
I am using a QTableWidget with combobox item and spinboxItem. What signal should I use to know if one item has his value changed.
thanks
Hi all;
I am using a QTableWidget with combobox item and spinboxItem. What signal should I use to know if one item has his value changed.
thanks
power of mind > mind of power
http://doc.trolltech.com/4.2/qtablew...ml#itemChanged
just wondering... Is browsing the doc sooooooooo tedious???![]()
Current Qt projects : QCodeEdit, RotiDeCode
Just as a side node, the table widget does not emit any signals in case those are cell widgets. The cell widgets itself emit their own signals when their values change.
Btw, is it an ordinary spinbox with plain numerical data? Another (and much more light-weight) option would be to set the data to the table widget items as numbers, not as text. Then the delegate would provide a spinbox as an editor, out of the box.
Qt Code:
int number = 123; item->setData(Qt::DisplayRole, number); // i don't remember if table widget items are editable by default, // the following line will make sure they are item->setFlags(item->flags() | Qt::ItemIsEditable); tableWidget->setItem(row, col, item);To copy to clipboard, switch view to plain text mode
J-P Nurmi
thanks for help but it is not working.
I want make the saveBotton not disabled when I make a change in the QTableWidget.
Qt Code:
{ ui.SaveBotton->setDisabled(false); }To copy to clipboard, switch view to plain text mode
power of mind > mind of power
Do you have access to the widgets when they are created? If so just connect proper signals...
Otherwise you should :
- add a QPointer<QWidget*>member
- on QTableWidget::cellActivated(), if non-zero, disconnect its proper signal (change of value) from your enable/disable slot
- set it to QTableWidget::cellWidget() and connect its proper signal to your enable/disable slot
Qt Code:
// assuming the class as a member like : QPointer<QWidget*> m_cellwidget void MyClass::on_tableWidget_cellActivated(int row, int column) { if ( m_cellwidget ) { disconnect(m_cellwidget, SIGNAL( ), this , SLOT ( ) ); } m_cellwidget = cellWidget(row, column); if ( m_cellwidget ) { connect(m_cellwidget, SIGNAL( ), this , SLOT ( ) ); } }To copy to clipboard, switch view to plain text mode
P.S. : Don't forget to fill in the blanks...Also as you mentionned that your widgets are of two types you should check for this and choose the appropriate signal...
Hope this helps.![]()
Last edited by fullmetalcoder; 1st April 2007 at 14:10. Reason: reformatted to look better
Current Qt projects : QCodeEdit, RotiDeCode
Bookmarks