Reputation: 887
I've seen the solution for python, but I need to know how to do it outside of python.
Here is what I have:
myTree->setCurrentIndex(myTree->currentIndex().sibling(0,0));
I also understand that setCurrentItem is a good way to go, but I can't get that to work either.
Upvotes: 4
Views: 1946
Reputation: 15996
Assuming myTree->topLevelItem(0)
does not return nullptr
, you can use the following:
myTree->setCurrentItem(
myTree->topLevelItem(0), // item
0, // column
QItemSelectionModel::Select // command
);
See Qt's documentation.
Upvotes: 4