Unsolved QTreeWidget setCurrentIndex
-
Hi, I have a QTreeWidget containing several Tree. First of all i initialize the QTreeWidget to select the first row in the tree.
ui->tree->topLevelItem(0)->setSelected(true); std::cout << " row: " << ui->tree->currentIndex().row() << std::endl;
when i do a cout the current row it always return -1. isnt it it shld be returning 0? Please advise. Thank you.
-
In Qt views, selected index is not the same as current index. So, get the selection, and check the row there - it should be OK.