bauervision bauervision - 1 year ago 226
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download