Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.15, 6.1, 6.2, 6.3
-
None
-
-
dfb4697e4a (qt/qtbase/dev) b1703b0c18 (qt/qtbase/6.3) 06207d19c6 (qt/qtbase/6.2) 06207d19c6 (qt/tqtc-qtbase/6.2) b1703b0c18 (qt/tqtc-qtbase/6.3) dfb4697e4a (qt/tqtc-qtbase/dev)
Description
In a QTreeWidget (QAbstractItemView) with single selection and drag&drop enabled an item is selected. When pressing the CTRL key and start dragging the selected item drag&drop does not work. Dragging other not selected items works as intended.
To reproduce the issue use the following Qt manual test example and one of the `Anonymous User` entries.
Upon further inspection the QAbstractItemView method selectionCommand
is responsible for this faulty behaviour. In case of single selection mode the already selected item should not be deselected when the CTRL key is pressed and the item is clicked again. This should only happen in case of multi selection mode to add or remove the item from the current selection.
Just noticed the issue is also present in multi selection mode. It looks like instead of handling CTRL key and MouseButtonPressed event one need to handle CTRL key and MouseButtonReleased event, as the drag&drop action is always started with a MouseButtonPressed event followed by a MouseMove event.