Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.7.0, 5.9.1
-
None
Description
In my application I'm using QTreeView for visualization of objects hierarchy. Selection mode is set to QAbstractItemView::ExtendedSelection. I have a model and selection model attached to it.
Imagine the following scenario:
- Click some item in tree view, lets call it 'Object_1'
- Change current item programmatically using selection model attached to tree view to 'Object_2'
- Hold down Shift key and click some other item in tree view, let's call it 'Object_3'
After this I expect that all tree view items between 'Object_2' and 'Object_3' will be selected, but instead I get selected items between 'Object_1' and 'Object_3'.
Looking in the source code of QAbstractItemView (parent class of QTreeView) I have noticed currentSelectionStartIndex member, that stores the item index from which to start selection when Shift+click action occurs. I didn't find any code that updates currentSelectionStartIndex member in case when the current item is updated through the selection model.
Also there is another member pressedIndex that is used for selection by mouse dragging. In my opinion it should be also updated, when current index is changed through selection model.