Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTreeView click problem
MLGDN last edited by
I use QTreeview with QStandardItemModel. for some reason I used a stylesheet to hide branch image, and set QStandardItem Icon with mine. I connect clicked(QModelIndex) signal with sltOnItemClicked(QModelIndex index) function to solve the expand and collapse problem. Displaying checkboxes is also needed, I do not use follow code connect(model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(onItemChanged(QStandardItem*)));, as it caused my program crash, so I deal it in sltOnItemClicked(QModelIndex index) function. my problem is how to know the mouse click on the checkbox, then I can deal with these issues separately.
I think you can hookup to QAbstractItemModel::dataChanged
and check the "checkbox" state there.