11 readonly property SelectionHandle pressedHandle: _private.pressedHandle
12 readonly property alias selectionArea: selectionArea
13 property alias selectionX: selectionArea.x
14 property alias selectionY: selectionArea.y
15 property alias selectionWidth: selectionArea.width
16 property alias selectionHeight: selectionArea.height
20 property SelectionHandle pressedHandle: null
30 LayoutMirroring.enabled: false
31 anchors.left: if (_private.pressedHandle) {
32 if (_private.pressedHandle.backwardDiagonal) {
33 handleTopLeft.horizontalCenter
34 } else if (_private.pressedHandle.forwardDiagonal) {
35 handleBottomLeft.horizontalCenter
36 } else if (_private.pressedHandle.horizontalOnly) {
37 handleLeft.horizontalCenter
40 anchors.right: if (_private.pressedHandle) {
41 if (_private.pressedHandle.backwardDiagonal) {
42 handleBottomRight.horizontalCenter
43 } else if (_private.pressedHandle.forwardDiagonal) {
44 handleTopRight.horizontalCenter
45 } else if (_private.pressedHandle.horizontalOnly) {
46 handleRight.horizontalCenter
49 anchors.top: if (_private.pressedHandle) {
50 if (_private.pressedHandle.backwardDiagonal) {
51 handleTopLeft.verticalCenter
52 } else if (_private.pressedHandle.forwardDiagonal) {
53 handleTopRight.verticalCenter
54 } else if (_private.pressedHandle.verticalOnly) {
55 handleTop.verticalCenter
58 anchors.bottom: if (_private.pressedHandle) {
59 if (_private.pressedHandle.backwardDiagonal) {
60 handleBottomRight.verticalCenter
61 } else if (_private.pressedHandle.forwardDiagonal) {
62 handleBottomLeft.verticalCenter
63 } else if (_private.pressedHandle.verticalOnly) {
64 handleBottom.verticalCenter
68 cursorShape: if (_private.pressedHandle || (pressed && enabled)) {
77 target: (selectionArea.width === root.width && selectionArea.height === root.height) || _private.pressedHandle ? null : selectionArea
79 maximumX: root.width - selectionArea.width
81 maximumY: root.height - selectionArea.height
89 position: SelectionHandle.TopLeft
90 lockX: _private.pressedHandle && _private.pressedHandle.backwardDiagonal
92 drag.maximumX: handleBottomRight.x - implicitWidth / 2
93 drag.maximumY: handleBottomRight.y - implicitHeight / 2
95 target: _private; property:
"pressedHandle"
96 value: handleTopLeft; when: handleTopLeft.pressed
97 restoreMode: Binding.RestoreBindingOrValue
102 visible: selectionArea.width >= implicitWidth
103 target: selectionArea
104 position: SelectionHandle.Top
105 lockY: _private.pressedHandle && _private.pressedHandle.verticalOnly
106 drag.maximumY: handleBottom.y - implicitHeight / 2
108 target: _private; property:
"pressedHandle"
109 value: handleTop; when: handleTop.pressed
110 restoreMode: Binding.RestoreBindingOrValue
115 target: selectionArea
116 position: SelectionHandle.TopRight
117 lockX: _private.pressedHandle && _private.pressedHandle.forwardDiagonal
119 drag.minimumX: handleBottomLeft.x + implicitWidth / 2
120 drag.maximumY: handleBottomLeft.y - implicitHeight / 2
122 target: _private; property:
"pressedHandle"
123 value: handleTopRight; when: handleTopRight.pressed
124 restoreMode: Binding.RestoreBindingOrValue
129 visible: selectionArea.height >= implicitHeight
130 target: selectionArea
131 position: SelectionHandle.Left
132 lockX: _private.pressedHandle && _private.pressedHandle.horizontalOnly
133 drag.maximumX: handleRight.x - implicitWidth / 2
135 target: _private; property:
"pressedHandle"
136 value: handleLeft; when: handleLeft.pressed
137 restoreMode: Binding.RestoreBindingOrValue
142 visible: selectionArea.height >= implicitHeight
143 target: selectionArea
144 position: SelectionHandle.Right
145 lockX: _private.pressedHandle && _private.pressedHandle.horizontalOnly
146 drag.minimumX: handleLeft.x + implicitWidth / 2
148 target: _private; property:
"pressedHandle"
149 value: handleRight; when: handleRight.pressed
150 restoreMode: Binding.RestoreBindingOrValue
155 target: selectionArea
156 position: SelectionHandle.BottomLeft
157 lockX: _private.pressedHandle && _private.pressedHandle.forwardDiagonal
159 drag.maximumX: handleTopRight.x - implicitWidth / 2
160 drag.minimumY: handleTopRight.y + implicitHeight / 2
162 target: _private; property:
"pressedHandle"
163 value: handleBottomLeft; when: handleBottomLeft.pressed
164 restoreMode: Binding.RestoreBindingOrValue
169 visible: selectionArea.width >= implicitWidth
170 target: selectionArea
171 position: SelectionHandle.Bottom
172 lockY: _private.pressedHandle && _private.pressedHandle.verticalOnly
173 drag.minimumY: handleTop.y + implicitHeight / 2
175 target: _private; property:
"pressedHandle"
176 value: handleBottom; when: handleBottom.pressed
177 restoreMode: Binding.RestoreBindingOrValue
181 id: handleBottomRight
182 target: selectionArea
183 position: SelectionHandle.BottomRight
184 lockX: _private.pressedHandle && _private.pressedHandle.backwardDiagonal
186 drag.minimumX: handleTopLeft.x + implicitWidth / 2
187 drag.minimumY: handleTopLeft.y + implicitHeight / 2
189 target: _private; property:
"pressedHandle"
190 value: handleBottomRight; when: handleBottomRight.pressed
191 restoreMode: Binding.RestoreBindingOrValue
195 onWidthChanged:
if (selectionArea.x + selectionArea.width > root.width) {
196 selectionArea.width = Math.max(root.width - selectionArea.x, handleTopLeft.implicitWidth/2)
197 if (selectionArea.x > root.width) {
198 selectionArea.x = Math.max(root.width - selectionArea.width, 0)
201 onHeightChanged:
if (selectionArea.y + selectionArea.height > root.height) {
202 selectionArea.height = Math.max(root.height - selectionArea.y, handleTopLeft.implicitHeight/2)
203 if (selectionArea.y > root.height) {
204 selectionArea.y = Math.max(root.height - selectionArea.height, 0)