diff options
Diffstat (limited to 'examples/quick/pointerhandlers')
-rw-r--r-- | examples/quick/pointerhandlers/CMakeLists.txt | 7 | ||||
-rw-r--r-- | examples/quick/pointerhandlers/components/CorkPanel.qml | 118 | ||||
-rw-r--r-- | examples/quick/pointerhandlers/components/images/cork.jpg | bin | 0 -> 149337 bytes | |||
-rw-r--r-- | examples/quick/pointerhandlers/components/images/note-yellow.png | bin | 0 -> 54283 bytes | |||
-rw-r--r-- | examples/quick/pointerhandlers/components/images/tack.png | bin | 0 -> 7282 bytes | |||
-rw-r--r-- | examples/quick/pointerhandlers/corkboards.qml | 51 | ||||
-rw-r--r-- | examples/quick/pointerhandlers/images/blur-circle.png | bin | 0 -> 4279 bytes | |||
-rw-r--r-- | examples/quick/pointerhandlers/multiflame.qml | 69 | ||||
-rw-r--r-- | examples/quick/pointerhandlers/pointerhandlers.qml | 2 | ||||
-rw-r--r-- | examples/quick/pointerhandlers/qml.qrc | 9 |
10 files changed, 255 insertions, 1 deletions
diff --git a/examples/quick/pointerhandlers/CMakeLists.txt b/examples/quick/pointerhandlers/CMakeLists.txt index 1f79a4b4ae..376d0e379d 100644 --- a/examples/quick/pointerhandlers/CMakeLists.txt +++ b/examples/quick/pointerhandlers/CMakeLists.txt @@ -33,6 +33,7 @@ qt_add_qml_module(pointerhandlersexample QML_FILES "components/Button.qml" "components/CheckBox.qml" + "components/CorkPanel.qml" "components/FakeFlickable.qml" "components/FlashAnimation.qml" "components/LeftDrawer.qml" @@ -42,12 +43,14 @@ qt_add_qml_module(pointerhandlersexample "components/ScrollBar.qml" "components/Slider.qml" "components/TouchpointFeedbackSprite.qml" + "corkboards.qml" "fakeFlickable.qml" "flingAnimation.qml" "joystick.qml" "map.qml" "mixer.qml" "multibuttons.qml" + "multiflame.qml" "pieMenu.qml" "pinchHandler.qml" "pointerhandlers.qml" @@ -57,6 +60,7 @@ qt_add_qml_module(pointerhandlersexample "tapHandler.qml" RESOURCES "components/images/checkmark.png" + "components/images/cork.jpg" "components/images/fingersprite.png" "components/images/mixer-knob.png" "components/images/mouse.png" @@ -64,8 +68,11 @@ qt_add_qml_module(pointerhandlersexample "components/images/mouse_middle.png" "components/images/mouse_right.png" "components/images/mouse_wheel_ridges.png" + "components/images/note-yellow.png" + "components/images/tack.png" "images/arrowhead.png" "images/balloon.png" + "images/blur-circle.png" "images/cursor-airbrush.png" "images/cursor-eraser.png" "images/cursor-felt-marker.png" diff --git a/examples/quick/pointerhandlers/components/CorkPanel.qml b/examples/quick/pointerhandlers/components/CorkPanel.qml new file mode 100644 index 0000000000..4aec2b5c7c --- /dev/null +++ b/examples/quick/pointerhandlers/components/CorkPanel.qml @@ -0,0 +1,118 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick + +Image { + id: corkPanel + source: Qt.resolvedUrl("images/cork.jpg") + width: ListView.view.width + height: ListView.view.height + fillMode: Image.PreserveAspectCrop + + required property string name + required property var notes + + TapHandler { + objectName: corkPanel.name + onTapped: corkPanel.Window.activeFocusItem.focus = false + } + + Text { + text: corkPanel.name + x: 15 + y: 8 + height: 40 + width: 370 + font.pixelSize: 18 + font.bold: true + color: "white" + style: Text.Outline + styleColor: "black" + wrapMode: Text.Wrap + } + + Repeater { + model: corkPanel.notes + Item { + id: fulcrum + + x: 100 + Math.random() * (corkPanel.width - 0.5 * paper.width) + y: 50 + Math.random() * (corkPanel.height - 0.5 * paper.height) + + Item { + id: note + scale: 0.7 + + Image { + id: paper + x: 8 + -width * 0.6 / 2 + y: -20 + source: "images/note-yellow.png" + scale: 0.6 + transformOrigin: Item.TopLeft + antialiasing: true + + DragHandler { + target: fulcrum + xAxis.minimum: 100 + xAxis.maximum: corkPanel.width - 80 + yAxis.minimum: 0 + yAxis.maximum: corkPanel.height - 80 + } + } + + TextEdit { + id: text + x: -104 + y: 36 + width: 215 + height: 24 + font.pixelSize: 24 + readOnly: false + selectByMouse: activeFocus + rotation: -8 + text: noteText + wrapMode: Text.Wrap + } + + rotation: -flickable.horizontalVelocity / 100 + Behavior on rotation { + SpringAnimation { + spring: 2.0 + damping: 0.15 + } + } + } + + Image { + x: -width / 2 + y: -height * 0.5 / 2 + source: "images/tack.png" + scale: 0.7 + transformOrigin: Item.TopLeft + } + + states: State { + name: "pressed" + when: text.activeFocus + PropertyChanges { + target: note + rotation: 8 + scale: 1 + } + PropertyChanges { + target: fulcrum + z: 8 + } + } + + transitions: Transition { + NumberAnimation { + properties: "rotation,scale" + duration: 200 + } + } + } + } +} diff --git a/examples/quick/pointerhandlers/components/images/cork.jpg b/examples/quick/pointerhandlers/components/images/cork.jpg Binary files differnew file mode 100644 index 0000000000..160bc002bf --- /dev/null +++ b/examples/quick/pointerhandlers/components/images/cork.jpg diff --git a/examples/quick/pointerhandlers/components/images/note-yellow.png b/examples/quick/pointerhandlers/components/images/note-yellow.png Binary files differnew file mode 100644 index 0000000000..3195952ad2 --- /dev/null +++ b/examples/quick/pointerhandlers/components/images/note-yellow.png diff --git a/examples/quick/pointerhandlers/components/images/tack.png b/examples/quick/pointerhandlers/components/images/tack.png Binary files differnew file mode 100644 index 0000000000..cef2d1cd23 --- /dev/null +++ b/examples/quick/pointerhandlers/components/images/tack.png diff --git a/examples/quick/pointerhandlers/corkboards.qml b/examples/quick/pointerhandlers/corkboards.qml new file mode 100644 index 0000000000..76928f1b8c --- /dev/null +++ b/examples/quick/pointerhandlers/corkboards.qml @@ -0,0 +1,51 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import "components" + +Rectangle { + width: 320; height: 480 + color: "#464646" + + ListModel { + id: list + + ListElement { + name: "Panel One" + notes: [ + ListElement { noteText: "Tap to edit" }, + ListElement { noteText: "Drag to move" }, + ListElement { noteText: "Flick to scroll" } + ] + } + + ListElement { + name: "Panel Two" + notes: [ + ListElement { noteText: "Note One" }, + ListElement { noteText: "Note Two" } + ] + } + + ListElement { + name: "Panel Three" + notes: [ + ListElement { noteText: "Note Three" } + ] + } + } + + ListView { + id: flickable + + anchors.fill: parent + focus: true + highlightRangeMode: ListView.StrictlyEnforceRange + orientation: ListView.Horizontal + snapMode: ListView.SnapOneItem + model: list + delegate: CorkPanel { objectName: name } + } +} + diff --git a/examples/quick/pointerhandlers/images/blur-circle.png b/examples/quick/pointerhandlers/images/blur-circle.png Binary files differnew file mode 100644 index 0000000000..1b03cd0b2c --- /dev/null +++ b/examples/quick/pointerhandlers/images/blur-circle.png diff --git a/examples/quick/pointerhandlers/multiflame.qml b/examples/quick/pointerhandlers/multiflame.qml new file mode 100644 index 0000000000..7793e52ad6 --- /dev/null +++ b/examples/quick/pointerhandlers/multiflame.qml @@ -0,0 +1,69 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Particles + +Rectangle { + id: root + width: 360 + height: 480 + color: "black" + + component ColoredEmitter: Emitter { + id: emitter + property string color + group: color + velocityFromMovement: 10 + emitRate: 80 + lifeSpan: 1500 + velocity: PointDirection { + y: -90 + yVariation: 50 + } + acceleration: PointDirection { + xVariation: 100 + yVariation: 90 + } + size: 51 + sizeVariation: 53 + endSize: 64 + enabled: handler.active + x: handler.point.position.x + y: handler.point.position.y + + PointHandler { + id: handler + parent: root + } + + ImageParticle { + id: img + groups: [emitter.color] + source: "images/blur-circle.png" + colorVariation: 0.1 + color: emitter.color + alpha: 0 + system: sys + } + } + + ParticleSystem { + id: sys + ColoredEmitter { + color: "indianred" + } + ColoredEmitter { + color: "greenyellow" + } + ColoredEmitter { + color: "yellow" + } + ColoredEmitter { + color: "darkorange" + } + ColoredEmitter { + color: "violet" + } + } +} diff --git a/examples/quick/pointerhandlers/pointerhandlers.qml b/examples/quick/pointerhandlers/pointerhandlers.qml index 447e3a8158..049182fa8a 100644 --- a/examples/quick/pointerhandlers/pointerhandlers.qml +++ b/examples/quick/pointerhandlers/pointerhandlers.qml @@ -20,12 +20,14 @@ Rectangle { addExample("multibuttons", "TapHandler: gesturePolicy (99 red balloons)", Qt.resolvedUrl("multibuttons.qml")) addExample("pieMenu", "TapHandler: pie menu", Qt.resolvedUrl("pieMenu.qml")) addExample("single point handler", "PointHandler: properties such as seat, device, modifiers, velocity, pressure", Qt.resolvedUrl("singlePointHandlerProperties.qml")) + addExample("multiflame", "PointHandler: particle flames around touchpoints", Qt.resolvedUrl("multiflame.qml")) addExample("hover sidebar", "HoverHandler: a hierarchy of items sharing the hover state", Qt.resolvedUrl("sidebar.qml")) addExample("joystick", "DragHandler: move one item inside another with any pointing device", Qt.resolvedUrl("joystick.qml")) addExample("mixer", "DragHandler: drag multiple sliders with multiple fingers", Qt.resolvedUrl("mixer.qml")) addExample("fling animation", "DragHandler: after dragging, use an animation to simulate momentum", Qt.resolvedUrl("flingAnimation.qml")) addExample("pinch", "PinchHandler: scale, rotate and drag", Qt.resolvedUrl("pinchHandler.qml")) addExample("map", "scale, pan, re-render at different resolutions", Qt.resolvedUrl("map.qml")) + addExample("corkboards", "editable, movable sticky notes in a ListView", Qt.resolvedUrl("corkboards.qml")) addExample("fake Flickable", "implementation of a simplified Flickable using only Items, DragHandler and MomentumAnimation", Qt.resolvedUrl("fakeFlickable.qml")) addExample("tablet canvas", "PointHandler and HoverHandler with a tablet: detect the stylus, and draw", Qt.resolvedUrl("tabletCanvasDrawing.qml")) } diff --git a/examples/quick/pointerhandlers/qml.qrc b/examples/quick/pointerhandlers/qml.qrc index e9a39bc50c..237eb8eae0 100644 --- a/examples/quick/pointerhandlers/qml.qrc +++ b/examples/quick/pointerhandlers/qml.qrc @@ -1,11 +1,13 @@ <RCC> - <qresource prefix="/pointerhandlers"> + <qresource prefix="/qt/qml/pointerhandlers"> + <file>corkboards.qml</file> <file>flingAnimation.qml</file> <file>fakeFlickable.qml</file> <file>joystick.qml</file> <file>map.qml</file> <file>mixer.qml</file> <file>multibuttons.qml</file> + <file>multiflame.qml</file> <file>pieMenu.qml</file> <file>pinchHandler.qml</file> <file>pointerhandlers.qml</file> @@ -15,6 +17,7 @@ <file>tapHandler.qml</file> <file>components/Button.qml</file> <file>components/CheckBox.qml</file> + <file>components/CorkPanel.qml</file> <file>components/FakeFlickable.qml</file> <file>components/FlashAnimation.qml</file> <file>components/LeftDrawer.qml</file> @@ -27,6 +30,10 @@ <file>images/arrowhead.png</file> <file>images/balloon.png</file> <file>components/images/checkmark.png</file> + <file>components/images/cork.jpg</file> + <file>components/images/note-yellow.png</file> + <file>components/images/tack.png</file> + <file>images/blur-circle.png</file> <file>images/cursor-airbrush.png</file> <file>images/cursor-eraser.png</file> <file>images/cursor-felt-marker.png</file> |