weixj2003ld
13th March 2012, 02:22
I create a tree with
and add signal and slots to it with the following code:
connect(tree,SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,SLOT(SlotItemClicked(QTreeWidgetItem *, int)));
I create a tree item of it with QTreeWidgetItem,and set it checked with setCheckState(0,Qt::Checked);
When I don't click checkbox of the tree item but the text of it,I find that it still has reaction,that is,the slot SlotItemClicked() still executes,but the check state of the tree item does not change.
Now I want to it reacts only the checkbox of the tree item is clicked.
How to do it?
and add signal and slots to it with the following code:
connect(tree,SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,SLOT(SlotItemClicked(QTreeWidgetItem *, int)));
I create a tree item of it with QTreeWidgetItem,and set it checked with setCheckState(0,Qt::Checked);
When I don't click checkbox of the tree item but the text of it,I find that it still has reaction,that is,the slot SlotItemClicked() still executes,but the check state of the tree item does not change.
Now I want to it reacts only the checkbox of the tree item is clicked.
How to do it?