weixj2003ld
20th September 2011, 16:00
If click the treeitem,I want to do something.So I use the following code:
connect(this,SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,SLOT(SlotItemClicked(QTreeWidgetItem *, int)));
the slot SlotItemClicked define as follows:
void SlotItemClicked(QTreeWidgetItem *item, int)))
{
.....
if(item->checkState(0)==Qt::Checked)
hideObj();
else
adddelobj->showObj();
....
}
but I find that,if the text of the item is clicked,the check state of the item is not changed(that is, the check box is still selected or still unselected,how to deal with it?
connect(this,SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,SLOT(SlotItemClicked(QTreeWidgetItem *, int)));
the slot SlotItemClicked define as follows:
void SlotItemClicked(QTreeWidgetItem *item, int)))
{
.....
if(item->checkState(0)==Qt::Checked)
hideObj();
else
adddelobj->showObj();
....
}
but I find that,if the text of the item is clicked,the check state of the item is not changed(that is, the check box is still selected or still unselected,how to deal with it?