diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2023-01-27 12:49:21 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-02-24 16:53:56 +0000 |
commit | 51e4ed51b10e568a6a09e771115ad149f6126ce2 (patch) | |
tree | d42494013f46a065e102ad5a1eb31e2caa02fffa /examples/demos/photosurface/resources | |
parent | fd0d36dbf7492dd409ce0c0c1723408bdc396768 (diff) |
Modernize the photosurface demo; update its walkthrough docs
- use Pointer Handlers idiomatically, rather than PinchArea and MouseArea
- give PinchHandler precedence over DragHandler
- use Controls ToolTip (much easier than the ad-hoc one from before)
- use ScrollView rather than ad-hoc scroll decorators
- improve usage of FolderListModel: required props, and stop
concatenating folder + name
- set an informative window title
- bring the picture(s) being interacted with to the top
- use MomemtumAnimation from qtdeclarative/examples/quick/pointerhandlers
- when the animation ends, grow the canvas rightwards and downwards
so that no images are lost by being "flung" in those directions
- make main.cpp optional again: handle arguments in QML
- use QtQuick.Dialogs and remove widgets dependency
- stop using context properties
- translate all strings
- fix qmllint warnings
- update the walkthrough docs to explain what we're doing
Task-number: QTBUG-108924
Change-Id: I5b10e314373d31e1b57b1031d481fa2b9b7afe7b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 489e346f37fbf31b0034f0e80fcd97e87c2e0304)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/demos/photosurface/resources')
-rw-r--r-- | examples/demos/photosurface/resources/MomentumAnimation.qml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/demos/photosurface/resources/MomentumAnimation.qml b/examples/demos/photosurface/resources/MomentumAnimation.qml new file mode 100644 index 000000000..bd5388fc6 --- /dev/null +++ b/examples/demos/photosurface/resources/MomentumAnimation.qml @@ -0,0 +1,34 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick + +ParallelAnimation { + id: root + property Item target: null + property int duration: 500 + property vector2d velocity: Qt.vector2d(0,0) + + function restart(vel) { + stop() + velocity = vel + start() + } + + NumberAnimation { + id: xAnim + target: root.target + property: "x" + to: target.x + velocity.x / duration * 100 + duration: root.duration + easing.type: Easing.OutQuad + } + NumberAnimation { + id: yAnim + target: root.target + property: "y" + to: target.y + velocity.y / duration * 100 + duration: root.duration + easing.type: Easing.OutQuad + } +} |