diff options
Diffstat (limited to 'src/quick/doc/snippets/pointerHandlers/rotateViaWheelOrDrag.qml')
-rw-r--r-- | src/quick/doc/snippets/pointerHandlers/rotateViaWheelOrDrag.qml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/quick/doc/snippets/pointerHandlers/rotateViaWheelOrDrag.qml b/src/quick/doc/snippets/pointerHandlers/rotateViaWheelOrDrag.qml new file mode 100644 index 0000000000..721a038e5f --- /dev/null +++ b/src/quick/doc/snippets/pointerHandlers/rotateViaWheelOrDrag.qml @@ -0,0 +1,32 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +//![0] +import QtQuick + +Rectangle { + width: 50; height: 200 + + Rectangle { + id: knob + width: parent.width; height: width; radius: width / 2 + anchors.centerIn: parent + color: "lightsteelblue" + + Rectangle { + antialiasing: true + width: 4; height: 20 + x: parent.width / 2 - 2 + } + + WheelHandler { + property: "rotation" + } + } + + DragHandler { + target: null + dragThreshold: 0 + yAxis.onActiveValueChanged: (delta)=> { knob.rotation -= delta } + } +} +//![0] |