PDA

View Full Version : QListWidgetItem with checkboxes: detecting when state changed



Byngl
1st April 2006, 23:28
Is there a signal emitted when the user changes the state of the checkbox? As far as I can tell it's not any of these:


// QTreeWidget
void currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
void itemActivated(QTreeWidgetItem *,int);
void itemChanged(QTreeWidgetItem * item, int column);
void itemClicked(QTreeWidgetItem *, int);
void itemCollapsed(QTreeWidgetItem *);
void itemDoubleClicked(QTreeWidgetItem *,int);
void itemEntered(QTreeWidgetItem *, int);
void itemExpanded(QTreeWidgetItem *);
void itemPressed(QTreeWidgetItem *, int);
void itemSelectionChanged();
// Signals inherited from QTreeView
void collapsed(const QModelIndex &);
void expanded(const QModelIndex &);
// Signals inherited from QAbstractItemView
void activated(const QModelIndex &);
void clicked(const QModelIndex &);
void doubleClicked(const QModelIndex &);
void entered(const QModelIndex &);
void pressed(const QModelIndex &);
void viewportEntered();

jpn
1st April 2006, 23:59
Nope, there is not..
http://lists.trolltech.com/qt-interest/2006-03/msg01327.html#msg01327

Byngl
2nd April 2006, 01:21
After further experimentation, I think QTreeWidget is emitting a itemChanged signal. In my original test code, I had inadvertently connected the itemChanged and itemPressed signals to the same slot.

jpn
2nd April 2006, 06:48
Hmm, somewhy I thought you were after a signal which would be emitted only in consequence of check state change.. :)
Yes, the itemChanged() signal is emitted when the check state changes. Though, it it also emitted whenever any item's value changes. This includes values of any item data role.