QTreeWidget is not working as expected when clicking on check-box of non-leaf item. My QTreeWidget has two level of child and each item in the tree widget can be checked (check-box is enabled for each item). In this QTreeWidget, leaf items are user selectable, but non-leaf items are not selectable and all items are enabled and user check-able.
[]Family node1
- []Primary node1
- []child1
- []Secondary node1
- []child1
[]Family node2
- []Primary node2
- []child2
- []Secondary node2
- []child2
Leaf items flag setting
Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled
Non-leaf items flag setting
Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate
When we directly click on leaf item's associated check-box, Qt is generating currentItemChanged() signal. But, when we click directly on non-leaf item's associated check-box, then currentItemChanged() signal is not getting generated. This causes inconvenience in the non-leaf item handling.
It was working fine in Qt 4.7.4, but it is not working in Qt 4.8.1 on all platforms (Windows, Darwin, and Linux).
I attached a sample program to reproduce this bug.
Is this a bug or expected behavior?
I am noticing this bug on all platforms (Linux CentOS, Windows 7, and MacOS) with Qt 4.8.
item->treeWidget()->clearSelection(); item->setSelected(true);
inhandleItemClicked()
help? – Andreas Fester