PDA

View Full Version : itemPressed of QTreeWidget



weixj2003ld
20th September 2011, 17: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?

weixj2003ld
21st September 2011, 11:19
Anyone help me?