diff options
| author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-08-10 14:13:52 +0200 |
|---|---|---|
| committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-08-11 14:58:35 +0200 |
| commit | b51ad14bc6a055de22b9c5f0083a3ca42795779b (patch) | |
| tree | 957621b14753996b5eab5897167331f27bae1f2e /src/quick/items/qquicktableview.cpp | |
| parent | e86a38f20f1b77ab2ee99de37e1f9724ce7cd14c (diff) | |
QQuickTableView: clear selection on tap directly in TableView
Before 6.4, it was only possible to make a selection in
TableView by using a SelectionRectangle. But in 6.4, you
can also make a selection directly in TableView by using
the shift+arrow keys. To make sure that a selection is
cleared either way on tap, move the implementation that
clears the selection from SelectionRectangle to TableView.
Pick-to: 6.4
Change-Id: Ic718763bf9b643cb3e3c04cc3b90c6ffcf9ca4b2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview.cpp')
| -rw-r--r-- | src/quick/items/qquicktableview.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index a8320d99b2..54781968b4 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -4039,15 +4039,19 @@ void QQuickTableViewPrivate::init() positionYAnimation.stop(); if (keyNavigationEnabled) q->forceActiveFocus(Qt::MouseFocusReason); - if (!q->isInteractive()) - setCurrentIndexFromTap(tapHandler->point().pressPosition()); + if (q->isInteractive()) + return; + clearSelection(); + setCurrentIndexFromTap(tapHandler->point().pressPosition()); }); QObject::connect(tapHandler, &QQuickTapHandler::tapped, [this, q, tapHandler] { if (!pointerNavigationEnabled) return; - if (q->isInteractive()) - setCurrentIndexFromTap(tapHandler->point().pressPosition()); + if (!q->isInteractive()) + return; + clearSelection(); + setCurrentIndexFromTap(tapHandler->point().pressPosition()); }); } |
