Loading two columns at start in QColumnView
Solved
General and Desktop
-
I would like to load two columns at start in QColumnView. In the first column with First level of rows. Second column with a particular row's children with a particular row being selected[ie., highlighted].
I tried calling the createColumn with the model index of the row in first column. But it didn't work. Is there any way? However in tree view it looks straight forward with QTreeView.expand(QModelIndex). Any help is much appreciated.
-
have you tried something like
columnView->selectionModel()->select(index,QItemSelectionModel::ClearAndSelect);
? -
Had a peak at the sources, the solution is:
columnView->selectionModel()->setCurrentIndex(index,QItemSelectionModel::Current|QItemSelectionModel::Select);
Not well documented, I agree