aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-08-25 10:59:06 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-26 15:03:47 +0000
commit51f80c1293d7ba6d8c874aa242156d067d574ba5 (patch)
treebcec7d6ec565dc8ca3e40840411d1c31c47babd2
parentecdbca3588bb44fb544695c2947948439ca7cbdf (diff)
SelectionRectangle: use transparent handles for the desktop styles
Showing selection handles for the desktop styles really doesn't look correct. So rather than adding something that looks a bit out of place, just use invisible handles instead. This allows the user to still drag on the corners of the selection. Change-Id: Ic13da3eeb24b293f1c7f87d78fe12e997651e579 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 0d3f0b581c2272c70c14b1811a3d65a52276988c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quickcontrols2/fusion/SelectionRectangle.qml35
-rw-r--r--src/quickcontrols2/macos/SelectionRectangle.qml46
-rw-r--r--src/quickcontrols2/windows/SelectionRectangle.qml46
3 files changed, 31 insertions, 96 deletions
diff --git a/src/quickcontrols2/fusion/SelectionRectangle.qml b/src/quickcontrols2/fusion/SelectionRectangle.qml
index 9837683416..2e6393a07e 100644
--- a/src/quickcontrols2/fusion/SelectionRectangle.qml
+++ b/src/quickcontrols2/fusion/SelectionRectangle.qml
@@ -43,26 +43,21 @@ import QtQuick.Controls.Fusion.impl
T.SelectionRectangle {
id: control
- topLeftHandle: handle
- bottomRightHandle: handle
-
- Component {
- id: handle
- SliderHandle {
- palette: SelectionRectangle.control.palette
- pressed: tapHandler.pressed || SelectionRectangle.dragging
- hovered: hoverHandler.hovered
- vertical: false
- visualFocus: false
- visible: SelectionRectangle.control.active
-
- HoverHandler {
- id: hoverHandler
- }
+ topLeftHandle: Item {
+ width: 20
+ height: 20
+ visible: SelectionRectangle.control.active
+ // This item is deliberately empty. Selection handles don't feel at home
+ // for this style. But we provide an invisible handle that the user can
+ // drag on.
+ }
- TapHandler {
- id: tapHandler
- }
- }
+ bottomRightHandle: Item {
+ width: 20
+ height: 20
+ visible: SelectionRectangle.control.active
+ // This item is deliberately empty. Selection handles don't feel at home
+ // for this style. But we provide an invisible handle that the user can
+ // drag on.
}
}
diff --git a/src/quickcontrols2/macos/SelectionRectangle.qml b/src/quickcontrols2/macos/SelectionRectangle.qml
index 138f574c9e..d54b6e9b42 100644
--- a/src/quickcontrols2/macos/SelectionRectangle.qml
+++ b/src/quickcontrols2/macos/SelectionRectangle.qml
@@ -44,49 +44,19 @@ T.SelectionRectangle {
topLeftHandle: Item {
width: 20
height: 20
- visible: control.active
- property T.SelectionRectangle control: SelectionRectangle.control
-
- Shape {
- x: (parent.width / 2) + 2
- y: (parent.height / 2) + 2
- width: 10
- height: 10
-
- ShapePath {
- fillColor: control.palette.alternateBase
- strokeWidth: -1
- startX: 0
- startY: 0
- PathLine { x: 0; y: 6 }
- PathLine { x: 6; y: 0 }
- PathLine { x: 0; y: 0 }
- }
- }
+ visible: SelectionRectangle.control.active
+ // This item is deliberately empty. Selection handles don't feel at home
+ // for this style. But we provide an invisible handle that the user can
+ // drag on.
}
bottomRightHandle: Item {
width: 20
height: 20
- visible: control.active
- property T.SelectionRectangle control: SelectionRectangle.control
-
- Shape {
- x: (parent.width / 2) - 8
- y: (parent.height / 2) - 8
- width: 10
- height: 10
-
- ShapePath {
- fillColor: control.palette.alternateBase
- strokeWidth: -1
- startX: 0
- startY: 6
- PathLine { x: 6; y: 6 }
- PathLine { x: 6; y: 0 }
- PathLine { x: 0; y: 6 }
- }
- }
+ visible: SelectionRectangle.control.active
+ // This item is deliberately empty. Selection handles don't feel at home
+ // for this style. But we provide an invisible handle that the user can
+ // drag on.
}
}
diff --git a/src/quickcontrols2/windows/SelectionRectangle.qml b/src/quickcontrols2/windows/SelectionRectangle.qml
index 138f574c9e..d54b6e9b42 100644
--- a/src/quickcontrols2/windows/SelectionRectangle.qml
+++ b/src/quickcontrols2/windows/SelectionRectangle.qml
@@ -44,49 +44,19 @@ T.SelectionRectangle {
topLeftHandle: Item {
width: 20
height: 20
- visible: control.active
- property T.SelectionRectangle control: SelectionRectangle.control
-
- Shape {
- x: (parent.width / 2) + 2
- y: (parent.height / 2) + 2
- width: 10
- height: 10
-
- ShapePath {
- fillColor: control.palette.alternateBase
- strokeWidth: -1
- startX: 0
- startY: 0
- PathLine { x: 0; y: 6 }
- PathLine { x: 6; y: 0 }
- PathLine { x: 0; y: 0 }
- }
- }
+ visible: SelectionRectangle.control.active
+ // This item is deliberately empty. Selection handles don't feel at home
+ // for this style. But we provide an invisible handle that the user can
+ // drag on.
}
bottomRightHandle: Item {
width: 20
height: 20
- visible: control.active
- property T.SelectionRectangle control: SelectionRectangle.control
-
- Shape {
- x: (parent.width / 2) - 8
- y: (parent.height / 2) - 8
- width: 10
- height: 10
-
- ShapePath {
- fillColor: control.palette.alternateBase
- strokeWidth: -1
- startX: 0
- startY: 6
- PathLine { x: 6; y: 6 }
- PathLine { x: 6; y: 0 }
- PathLine { x: 0; y: 6 }
- }
- }
+ visible: SelectionRectangle.control.active
+ // This item is deliberately empty. Selection handles don't feel at home
+ // for this style. But we provide an invisible handle that the user can
+ // drag on.
}
}