path: root/src/widgets/itemviews
diff options
authorChristian Ehrlicher <>2019-11-05 07:49:48 +0100
committerChristian Ehrlicher <>2019-11-06 06:59:38 +0100
commit88047be4ecb99799f4876ff3e7001abe34ac29bc (patch)
tree67b08d6ccc3acdcb12c48220f297dae0e515facb /src/widgets/itemviews
parentbc4c2382aacbb33fad4a2d06fc631e4859f12a33 (diff)
QAbstractItemView: don't toggle selection on mouse move on some index
In single selection mode, the current selection toggled when the user pressed the left mouse + Ctrl key and then moved the mouse over the item. This was introduced with 28a21d98ef8d880a6dd86ee19dd803424bb5eae1 which added the possibility to deselect an item in single selection mode. Fix it by adding a check if the event was a mouse move event and use the old codepath for it. Fixes: QTBUG-77353 Change-Id: Id845ada302c92646885dfd966721b00d940f1260 Reviewed-by: Thorbjørn Lund Martsum <>
Diffstat (limited to 'src/widgets/itemviews')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index c2afed775c..b1557e9af4 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -3967,7 +3967,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QM
case SingleSelection: // ClearAndSelect on valid index otherwise NoUpdate
if (event && event->type() == QEvent::MouseButtonRelease)
return QItemSelectionModel::NoUpdate;
- if ((keyModifiers & Qt::ControlModifier) && d->selectionModel->isSelected(index))
+ if ((keyModifiers & Qt::ControlModifier) && d->selectionModel->isSelected(index) && event->type() != QEvent::MouseMove)
return QItemSelectionModel::Deselect | d->selectionBehaviorFlags();
return QItemSelectionModel::ClearAndSelect | d->selectionBehaviorFlags();