I have a need here regarding multiple selection of items in the QTreeView
. I have two widgets, QTreeView
on left and another QGLWidget
on the right. If I do a multiple selection, I must highlight the items in the glwidget. Vice versa, I need to highlight the items in the tree view if multiple selection is done on the glwidget. Currently, I am able to update single item by setting the current index of the tree view. Any ideas on how to update the selection of multiple items on the tree view with multiple selection on glwidget?
You can use the tree view's item selection model (treeView->selectionMode(), of type QItemSelectionModel). It has a signal selectionChanged() you can connect to to receive tree view selection changes and apply them to the GL view.
When receiving selection events from the GL view, you can use QItemSelectionModel::select()
to propagate them to the tree view.
To enable multiselection on your treeview, call setSelectionMode( MultiSelection )
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With