diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-28 09:34:00 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-11-03 09:14:48 +0100 |
| commit | d7862eac1b09f9fb28e540970d5cc98cb6479c52 (patch) | |
| tree | 46ff6bc99d2b8aafcc60c766973a3e9c04529bdf /examples/quick/pointerhandlers/components/ScrollBar.qml | |
| parent | 2a60d5eb1c06b9a3b36af324a8c44bdc0cb9d523 (diff) | |
Update examples to use new PropertyChanges
Also, prefer the multi-line syntax over ';'-separated bindings for
readability.
Change-Id: I3d6eb854e514ee257ca83773a11e6e9e10770bff
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples/quick/pointerhandlers/components/ScrollBar.qml')
| -rw-r--r-- | examples/quick/pointerhandlers/components/ScrollBar.qml | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/examples/quick/pointerhandlers/components/ScrollBar.qml b/examples/quick/pointerhandlers/components/ScrollBar.qml index 0ed720eca0..cd1efe2e12 100644 --- a/examples/quick/pointerhandlers/components/ScrollBar.qml +++ b/examples/quick/pointerhandlers/components/ScrollBar.qml @@ -115,47 +115,41 @@ Rectangle { State { name: "horizontal" PropertyChanges { - target: knob - max: root.width - knob.width - scrolledX: Math.min(max, Math.max(0, max * flick.contentX / (flick.width - flick.contentWidth))) - scrolledY: 1 - scrollDistance: flick.width - flick.contentWidth - width: flick.width * (flick.width / flick.contentWidth) - (height - anchors.margins) * 2 - height: root.height - 2 - } - PropertyChanges { - target: drag - xAxis.minimum: 0 - xAxis.maximum: knob.max - yAxis.minimum: 1 - yAxis.maximum: 1 - } - PropertyChanges { - target: root - position: knob.x / drag.xAxis.maximum + knob { + max: root.width - knob.width + scrolledX: Math.min(max, Math.max(0, max * flick.contentX / (flick.width - flick.contentWidth))) + scrolledY: 1 + scrollDistance: flick.width - flick.contentWidth + width: flick.width * (flick.width / flick.contentWidth) - (height - anchors.margins) * 2 + height: root.height - 2 + } + drag { + xAxis.minimum: 0 + xAxis.maximum: knob.max + yAxis.minimum: 1 + yAxis.maximum: 1 + } + root.position: knob.x / drag.xAxis.maximum } }, State { name: "vertical" PropertyChanges { - target: knob - max: root.height - knob.height - scrolledX: 1 - scrolledY: Math.min(max, Math.max(0, max * flick.contentY / (flick.height - flick.contentHeight))) - scrollDistance: flick.height - flick.contentHeight - width: root.width - 2 - height: root.width - 2 - } - PropertyChanges { - target: drag - xAxis.minimum: 1 - xAxis.maximum: 1 - yAxis.minimum: 0 - yAxis.maximum: knob.max - } - PropertyChanges { - target: root - position: knob.y / drag.yAxis.maximum + knob { + max: root.height - knob.height + scrolledX: 1 + scrolledY: Math.min(max, Math.max(0, max * flick.contentY / (flick.height - flick.contentHeight))) + scrollDistance: flick.height - flick.contentHeight + width: root.width - 2 + height: root.width - 2 + } + drag { + xAxis.minimum: 1 + xAxis.maximum: 1 + yAxis.minimum: 0 + yAxis.maximum: knob.max + } + root.position: knob.y / drag.yAxis.maximum } } ] |
