Using TreeWidgets
-
Being a hierarchical view, no, there is no such concept as an index here. I wouldn't make sense at all.
Which API call do you refer when talking about "a simple index number"? Maybe there's something similar in the tree view...
-
The [[Doc:QTreeWidget]] signals contain a QTreeWidgetItem pointer, you can work on that. Isn't that sufficient?
-
If you think it helps you, you could use a custom data role on your items and generate a unique ID number that you store in that role. You can then retreive that ID from the item when it is clicked. Reference the setData and data methods in QTreeWidgetItem.
-
Sorry, I don't get the use case. What do you need that index for other than poking the correct item out of the view?
-
If you take the QTreeWidget pointer delivered by the signals, you already HAVE the correct item.
-
[quote author="Arukas" date="1328130428"]I just want to get the correct item out of the tree. Is the only way to use a
@map<QTreeWidgetItem, int>@
or does the treewidget do something like that already for you?
[/quote]
I posted a solution for that just above...