Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Model/view Combobox wrong index
lloydqt last edited by
I am using QComboBox in Model/View manner. QStandardItemModel is used as the model, and it is used like a checkable tree. using the QStandardItemModel::setItem() call, root nodes are added and using QStandardItem::setChild() call child nodes to the root nodes are added. I am catching the activated(int) signal of QComboBox (could not find a better signal), but it returns a wrong index.
As an example lets say I have 2 root nodes and there is 4 child nodes in first root node, and 2 child nodes in 2nd root node. If I click 3nd item of the 1st root node, the index returned is 2 (I understand that index starts from 0) instead of 3!. What could be the reason, is there a better way to handle this?
goblincoding last edited by
Do you have any code for us to look at? I for one find it a bit tricky to figure out exactly what you mean :)