Loading two columns at start in QColumnView
-
wrote on 24 Feb 2017, 13:50 last edited by
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.
-
wrote on 24 Feb 2017, 14:40 last edited by
Had a peak at the sources, the solution is:
columnView->selectionModel()->setCurrentIndex(index,QItemSelectionModel::Current|QItemSelectionModel::Select);
Not well documented, I agree
-
wrote on 24 Feb 2017, 13:55 last edited by
have you tried something like
columnView->selectionModel()->select(index,QItemSelectionModel::ClearAndSelect);
? -
have you tried something like
columnView->selectionModel()->select(index,QItemSelectionModel::ClearAndSelect);
?wrote on 24 Feb 2017, 14:10 last edited by@VRonin Yes, tried this already. It selects the row[with grey background - not with blue background] but the next column is not loaded.
Even tried invoking the clicked() event on QColumnView with the desired index. It also failed.
-
wrote on 24 Feb 2017, 14:40 last edited by
Had a peak at the sources, the solution is:
columnView->selectionModel()->setCurrentIndex(index,QItemSelectionModel::Current|QItemSelectionModel::Select);
Not well documented, I agree
-
Had a peak at the sources, the solution is:
columnView->selectionModel()->setCurrentIndex(index,QItemSelectionModel::Current|QItemSelectionModel::Select);
Not well documented, I agree
4/5