view raw
bauervision bauervision - 7 months ago 95
C++ Question

QTreeWidget select first row

I've seen the solution for python, but I need to know how to do it outside of python.

Here is what I have:


I also understand that setCurrentItem is a good way to go, but I can't get that to work either.


Assuming myTree->topLevelItem(0) does not return nullptr, you can use the following:

    myTree->topLevelItem(0),    // item
    0,                          // column
    QItemSelectionModel::Select // command

See Qt's documentation.