I have a QTreeView with the model set from a QSqlQueryModel.
Now I need to select the first row when the query is run.
I can't find any way to do this programatically.
QTreeWidget has setCurrentItem() and some other means, but QTreeView and QSqlQueryModel don't seem to have any methods for selection. Do I have to resort to using a QTreeWidget ?
BTW: Found this in the docs, but it doesn't select anything:
treeView->setCurrentIndex(first);
QModelIndex first = model->index(0, 0, QModelIndex());
treeView->setCurrentIndex(first);
To copy to clipboard, switch view to plain text mode
Bookmarks