Is it possible to set multiple items selcted in QTreeWidget?
-
setCurrentItem only sets one item selected. I don't see any method to set more than 1 item selected programmatically, but maybe I'm overlooking something?
Of course, my tree widget is configured to enable multiple selection.
Note that I'm using QTreeWidget, not QTreeView.
-
Yes, of course it is.
Make a new "QItemSelectionModel":http://qt-project.org/doc/qt-5.0/qtcore/qitemselectionmodel.html, call select() and set to "QTreeWidget::setSelectionModel":http://qt-project.org/doc/qt-5.0/qtwidgets/qtreewidget.html#setSelectionModel
-
Hi,
You can use the "item selection model":http://qt-project.org/doc/qt-4.8/qitemselectionmodel.html of the QTreeWidget for that
-
Thanks a lot! Shame I overlooked it.