diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2024-03-25 10:02:57 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2024-03-26 21:33:04 +0100 |
commit | f0fbedbe69532d9f5d1bc622f0b5b1ed16f23f2b (patch) | |
tree | ace446031511c8862f5a6acd145e57ad924c584a /tests/manual | |
parent | 1f7a34d20ad39dec7aac959facf0064c7d68be60 (diff) |
SelectionRectangle: ensure we remove or update selection handles if selection changes
If you make a selection with SelectionRectangle and then resize a
row, the selection handles will not move to the resized position.
Likewise, if you do a selection, but then clear the selection
by interacting with the ItemSelectionModel directly, the
selection handles will not be updated to reflect the changes.
To fix this bug, this patch will add a callback from TableView to
SelectionRectangle that can be used to notify when changes are
done outside of SelectionRectangle. This especially allows us to:
- Remove the selection handles if the active selection is cleared
or changed programatically (or anyway not by SelectionRectangle).
- Keep the selection handles, and update their position, when rows
or columns are merely resized.
This change also allows us to clean up qquickselectionrectangle.cpp
a bit, and remove e.g a now superfluous tap handler listener.
Task-number: QTBUG-121143
Pick-to: 6.7 6.6 6.5
Change-Id: Id170520d49bc92c0bb9d16deaba741cab6f5c553
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/tableview/abstracttablemodel/main.qml | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/manual/tableview/abstracttablemodel/main.qml b/tests/manual/tableview/abstracttablemodel/main.qml index e8d1192ede..5578e86dba 100644 --- a/tests/manual/tableview/abstracttablemodel/main.qml +++ b/tests/manual/tableview/abstracttablemodel/main.qml @@ -198,6 +198,10 @@ ApplicationWindow { ] Layout.fillWidth: false } + Button { + text: "Clear selection" + onClicked: tableView.selectionModel.clearSelection() + } } } |