aboutsummaryrefslogtreecommitdiffstats
path: root/examples/imports
diff options
context:
space:
mode:
Diffstat (limited to 'examples/imports')
-rw-r--r--examples/imports/TransitionView/DefaultPageEffect.qml36
-rw-r--r--examples/imports/TransitionView/PageEffect.qml156
-rw-r--r--examples/imports/TransitionView/PageFadeEffect.qml81
-rw-r--r--examples/imports/TransitionView/PagePushLeftEffect.qml156
-rw-r--r--examples/imports/TransitionView/PagePushRightEffect.qml156
-rw-r--r--examples/imports/TransitionView/PagePushUpEffect.qml163
-rw-r--r--examples/imports/TransitionView/PageSlideDownEffect.qml85
-rw-r--r--examples/imports/TransitionView/PageSlideLeftEffect.qml61
-rw-r--r--examples/imports/TransitionView/PageSlideRightEffect.qml61
-rw-r--r--examples/imports/TransitionView/PageSlideUpEffect.qml61
-rw-r--r--examples/imports/TransitionView/PageTransition.qml91
-rw-r--r--examples/imports/TransitionView/SwipeInteraction.qml123
-rw-r--r--examples/imports/TransitionView/TransitionList.qml101
-rw-r--r--examples/imports/TransitionView/TransitionView.qml226
-rw-r--r--examples/imports/TransitionView/qmldir15
15 files changed, 1572 insertions, 0 deletions
diff --git a/examples/imports/TransitionView/DefaultPageEffect.qml b/examples/imports/TransitionView/DefaultPageEffect.qml
new file mode 100644
index 0000000..f9dd5ed
--- /dev/null
+++ b/examples/imports/TransitionView/DefaultPageEffect.qml
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+
+PageEffect {
+ //No Effect
+ duration: 0
+}
diff --git a/examples/imports/TransitionView/PageEffect.qml b/examples/imports/TransitionView/PageEffect.qml
new file mode 100644
index 0000000..c2cd5d4
--- /dev/null
+++ b/examples/imports/TransitionView/PageEffect.qml
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+QtObject {
+ id: root
+ signal finished
+ signal started
+ signal reseted
+ function reset() {
+ /*
+ if (root.duration === 0) {
+ root.transitionView.__setupCurrentItem()
+ return
+ }*/
+
+ /* We set the parents to the content items to apply effects */
+
+ resetProperties()
+
+ from.parent = transitionView.__fromContentItem
+ to.parent = transitionView.__toContentItem
+ root.progress = root.backwards ? 100 : 0
+
+ enable()
+ root.progress = -1
+ root.progress = 0
+ }
+
+ property bool __aborted: false
+
+ function enable() {
+ timeline.enabled = true
+ root.started()
+ }
+
+ function start() {
+ anim.from = Math.min(root.progress, 100)
+ anim.to = root.backwards ? 0 : 100
+ anim.duration = root.duration * Math.abs(anim.to - anim.from) / 100
+
+ root.__aborted = false
+
+ anim.start()
+ }
+
+ function abort() {
+
+ anim.from = root.progress
+ anim.to = root.backwards ? 100 : 0
+
+ anim.duration = root.duration * Math.abs(anim.from - anim.to) / 100
+
+ root.__aborted = true
+ anim.restart()
+
+ }
+
+ function stop() {
+ anim.stop()
+ }
+
+ property Item from
+ property Item to
+
+ property Item transitionView
+
+ property real duration: 250
+ property alias easing: anim.easing
+
+ property Timeline timeline: Timeline {
+
+ }
+
+ property real progress: 0
+
+ property bool backwards: false
+
+ property Binding timelineBinding: Binding {
+ target: timeline
+ property: "currentFrame"
+ value: root.progress * 10
+ }
+
+ function resetProperties() {
+ transitionView.__fromContentItem.opacity = 1
+ transitionView.__fromContentItem.x = 0
+ transitionView.__fromContentItem.y = 0
+ transitionView.__fromContentItem.z = 0
+ transitionView.__fromContentItem.scale = 1
+
+ transitionView.__toContentItem.opacity = 1
+ transitionView.__toContentItem.x = 0
+ transitionView.__toContentItem.y = 0
+ transitionView.__toContentItem.z = 0
+ transitionView.__toContentItem.scale = 1
+ }
+
+ property PropertyAnimation __anim: PropertyAnimation {
+ id: anim
+ duration: 250
+ loops: 1
+ target: root
+ property: "progress"
+ onStopped: {
+ timeline.enabled = false
+ /* reset all typical properties */
+
+ resetProperties()
+
+ root.finished()
+
+ if (!root.__aborted) {
+ root.transitionView.__setupCurrentItem()
+ } else {
+ if (root.transitionView.nextItem) {
+ root.transitionView.nextItem.parent = transitionView.__stack
+ root.transitionView.nextItem = root.transitionView.currentItem
+ }
+ root.transitionView.__setupCurrentItem()
+ root.transitionView.nextItem = null
+ }
+
+ root.progress = 0
+ }
+ }
+
+}
diff --git a/examples/imports/TransitionView/PageFadeEffect.qml b/examples/imports/TransitionView/PageFadeEffect.qml
new file mode 100644
index 0000000..8eb4707
--- /dev/null
+++ b/examples/imports/TransitionView/PageFadeEffect.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+PageEffect {
+ id: effect
+ //Fade Effect
+ duration: 250
+ onStarted: {
+ group01.target = transitionView.__fromContentItem
+ group02.target = transitionView.__toContentItem
+ }
+
+ timeline: Timeline {
+ startFrame: 0
+ endFrame: 1000
+
+ KeyframeGroup {
+ id: group01
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: 1
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 0
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group02
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: 0
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 1
+ easing: effect.easing
+ }
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/PagePushLeftEffect.qml b/examples/imports/TransitionView/PagePushLeftEffect.qml
new file mode 100644
index 0000000..e2fd55d
--- /dev/null
+++ b/examples/imports/TransitionView/PagePushLeftEffect.qml
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+PageEffect {
+ id: effect
+
+ property real scale: 1
+ property real opacity: 1
+
+ duration: 250
+ onStarted: {
+ group01.target = transitionView.__fromContentItem
+ group02.target = transitionView.__toContentItem
+ group03.target = transitionView.__fromContentItem
+ group04.target = transitionView.__toContentItem
+ group05.target = transitionView.__fromContentItem
+ group06.target = transitionView.__toContentItem
+ }
+
+ timeline: Timeline {
+ startFrame: 0
+ endFrame: 1000
+
+ KeyframeGroup {
+ id: group01
+
+ property: "x"
+
+ Keyframe {
+ frame: 0
+ value: 0
+ }
+
+ Keyframe {
+ frame: 1000
+ value: effect.transitionView.width
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group02
+
+ property: "x"
+
+ Keyframe {
+ frame: 0
+ value: -effect.transitionView.width
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 0
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group03
+
+ property: "scale"
+
+ Keyframe {
+ frame: 0
+ value: 1
+ }
+
+ Keyframe {
+ frame: 1000
+ value: effect.scale
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group04
+
+ property: "scale"
+
+ Keyframe {
+ frame: 0
+ value: effect.scale
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 1
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group05
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: 1
+ }
+
+ Keyframe {
+ frame: 1000
+ value: effect.opacity
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group06
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: effect.opacity
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 1
+ easing: effect.easing
+ }
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/PagePushRightEffect.qml b/examples/imports/TransitionView/PagePushRightEffect.qml
new file mode 100644
index 0000000..45e0b14
--- /dev/null
+++ b/examples/imports/TransitionView/PagePushRightEffect.qml
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+PageEffect {
+ id: effect
+
+ property real scale: 1
+ property real opacity: 1
+
+ duration: 250
+ onStarted: {
+ group01.target = transitionView.__fromContentItem
+ group02.target = transitionView.__toContentItem
+ group03.target = transitionView.__fromContentItem
+ group04.target = transitionView.__toContentItem
+ group05.target = transitionView.__fromContentItem
+ group06.target = transitionView.__toContentItem
+ }
+
+ timeline: Timeline {
+ startFrame: 0
+ endFrame: 1000
+
+ KeyframeGroup {
+ id: group01
+
+ property: "x"
+
+ Keyframe {
+ frame: 0
+ value: 0
+ }
+
+ Keyframe {
+ frame: 1000
+ value: -effect.transitionView.width
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group02
+
+ property: "x"
+
+ Keyframe {
+ frame: 0
+ value: effect.transitionView.width
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 0
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group03
+
+ property: "scale"
+
+ Keyframe {
+ frame: 0
+ value: 1
+ }
+
+ Keyframe {
+ frame: 1000
+ value: effect.scale
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group04
+
+ property: "scale"
+
+ Keyframe {
+ frame: 0
+ value: effect.scale
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 1
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group05
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: 1
+ }
+
+ Keyframe {
+ frame: 1000
+ value: effect.opacity
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group06
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: effect.opacity
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 1
+ easing: effect.easing
+ }
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/PagePushUpEffect.qml b/examples/imports/TransitionView/PagePushUpEffect.qml
new file mode 100644
index 0000000..1dfe306
--- /dev/null
+++ b/examples/imports/TransitionView/PagePushUpEffect.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+PageEffect {
+ id: effect
+
+ property real scale: 1
+ property real inOpacity: 1
+ property real outOpacity: 1
+
+ property int fromItemHeight: effect.transitionView.height
+
+ property bool revealCurrent: false
+
+ duration: 250
+ onStarted: {
+ group01.target = transitionView.__fromContentItem
+ group02.target = transitionView.__toContentItem
+ group03.target = transitionView.__fromContentItem
+ group04.target = transitionView.__toContentItem
+ group05.target = transitionView.__fromContentItem
+ group06.target = transitionView.__toContentItem
+ if (effect.revealCurrent)
+ group01.target.z = 1
+ }
+
+ timeline: Timeline {
+ startFrame: 0
+ endFrame: 1000
+
+ KeyframeGroup {
+ id: group01
+
+ property: "y"
+
+ Keyframe {
+ frame: 0
+ value: 0
+ }
+
+ Keyframe {
+ frame: 1000
+ value: -fromItemHeight
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group02
+
+ property: "y"
+
+ Keyframe {
+ frame: 0
+ value: effect.revealCurrent ? 0 : effect.transitionView.height
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 0
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group03
+
+ property: "scale"
+
+ Keyframe {
+ frame: 0
+ value: 1
+ }
+
+ Keyframe {
+ frame: 1000
+ value: effect.scale
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group04
+
+ property: "scale"
+
+ Keyframe {
+ frame: 0
+ value: effect.scale
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 1
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group05
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: 1
+ }
+
+ Keyframe {
+ frame: 1000
+ value: effect.outOpacity
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group06
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: effect.inOpacity
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 1
+ easing: effect.easing
+ }
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/PageSlideDownEffect.qml b/examples/imports/TransitionView/PageSlideDownEffect.qml
new file mode 100644
index 0000000..9731b06
--- /dev/null
+++ b/examples/imports/TransitionView/PageSlideDownEffect.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+PageEffect {
+ id: effect
+
+ property real itemHeight: transitionView.height
+ property real outOpacity: 1
+
+ duration: 250
+ onStarted: {
+ group01.target = transitionView.__toContentItem
+ group02.target = transitionView.__fromContentItem
+ group01.target.z = 1
+ }
+
+ timeline: Timeline {
+ startFrame: 0
+ endFrame: 1000
+
+ KeyframeGroup {
+ id: group01
+
+ property: "y"
+
+ Keyframe {
+ frame: 0
+ value: -effect.itemHeight
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 0
+ easing: effect.easing
+ }
+ }
+
+ KeyframeGroup {
+ id: group02
+
+ property: "opacity"
+
+ Keyframe {
+ frame: 0
+ value: 1
+ }
+
+ Keyframe {
+ frame: 1000
+ value: effect.outOpacity
+ easing: effect.easing
+ }
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/PageSlideLeftEffect.qml b/examples/imports/TransitionView/PageSlideLeftEffect.qml
new file mode 100644
index 0000000..182cd35
--- /dev/null
+++ b/examples/imports/TransitionView/PageSlideLeftEffect.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+PageEffect {
+ id: effect
+
+ duration: 250
+ onStarted: group01.target = transitionView.__toContentItem
+
+ timeline: Timeline {
+ startFrame: 0
+ endFrame: 1000
+
+ KeyframeGroup {
+ id: group01
+
+ property: "x"
+
+ Keyframe {
+ frame: 0
+ value: -transitionView.width
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 0
+ easing: effect.easing
+ }
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/PageSlideRightEffect.qml b/examples/imports/TransitionView/PageSlideRightEffect.qml
new file mode 100644
index 0000000..4bdf4ef
--- /dev/null
+++ b/examples/imports/TransitionView/PageSlideRightEffect.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+PageEffect {
+ id: effect
+
+ duration: 250
+ onStarted: group01.target = transitionView.__toContentItem
+
+ timeline: Timeline {
+ startFrame: 0
+ endFrame: 1000
+
+ KeyframeGroup {
+ id: group01
+
+ property: "x"
+
+ Keyframe {
+ frame: 0
+ value:transitionView.width
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 0
+ easing: effect.easing
+ }
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/PageSlideUpEffect.qml b/examples/imports/TransitionView/PageSlideUpEffect.qml
new file mode 100644
index 0000000..3561562
--- /dev/null
+++ b/examples/imports/TransitionView/PageSlideUpEffect.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+import QtQuick.Timeline 1.0
+
+PageEffect {
+ id: effect
+
+ duration: 250
+ onStarted: group01.target = transitionView.__toContentItem
+
+ timeline: Timeline {
+ startFrame: 0
+ endFrame: 1000
+
+ KeyframeGroup {
+ id: group01
+
+ property: "y"
+
+ Keyframe {
+ frame: 0
+ value: transitionView.height
+ }
+
+ Keyframe {
+ frame: 1000
+ value: 0
+ easing: effect.easing
+ }
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/PageTransition.qml b/examples/imports/TransitionView/PageTransition.qml
new file mode 100644
index 0000000..f4ec7b5
--- /dev/null
+++ b/examples/imports/TransitionView/PageTransition.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+
+QtObject {
+ id: root
+
+ signal finished
+
+ /* Those should be lists that allow a n*n mappings. */
+ property Item from: null
+ property Item to: null
+ property int duration
+
+ property var transitionView: Item {}
+
+ property real progress: effect.progress
+
+ function __start() {
+ root.effect.start()
+ }
+
+ function __enable() {
+ effect.enable()
+ }
+
+ function __reset(current, next) {
+ root.effect.from = current
+ root.effect.to = next
+ root.effect.transitionView = root.transitionView
+
+ root.effect.reset()
+ }
+
+ function __stop(current, next) {
+ root.effect.stop()
+ }
+
+ function trigger() {
+ if (root.from === null)
+ return;
+ if (root.to === null)
+ return;
+
+ if (root.from === transitionView.currentItem)
+ transitionView.gotoPage(root)
+ }
+
+ property PageEffect effect: DefaultPageEffect {
+ transitionView: transitionView
+
+ }
+
+ onEffectChanged: {
+ root.effect.transitionView = root.transitionView
+ }
+
+ property Connections effectConnection: Connections {
+ target: root.effect
+ onFinished: root.finished
+ }
+}
+
diff --git a/examples/imports/TransitionView/SwipeInteraction.qml b/examples/imports/TransitionView/SwipeInteraction.qml
new file mode 100644
index 0000000..3516082
--- /dev/null
+++ b/examples/imports/TransitionView/SwipeInteraction.qml
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.12
+import TransitionItem 1.0
+import QtQuick.Controls 2.3
+import QtQuick.Timeline 1.0
+
+Item {
+ id: root
+ property var transitionView
+ property var list
+ parent: transitionView
+ anchors.fill: parent
+ z: -1
+
+ property real threshold: 35
+
+ property bool horizontal: true
+
+ property Item __activeItem
+
+ property bool __reactToTransition: false
+
+
+ Timer {
+ id: blocker
+ running: false
+ interval: 200
+ repeat: false
+ onTriggered: handler.enabled = true
+
+ }
+
+ Connections {
+ target: transitionView
+ onTransitionFinished: {
+ if (!root.__reactToTransition)
+ return
+ /* This is a tricky one. We have to also update the list.
+ The connection could be also done the other way around */
+ list.currentItem = root.__activeItem
+ root.__reactToTransition = false
+ }
+ }
+
+ DragHandler {
+ id: handler
+ xAxis.enabled: root.horizontal
+ yAxis.enabled: !root.horizontal
+ target: null
+ enabled: true
+
+ function distance() {
+ if (root.horizontal)
+ return (centroid.position.x - centroid.pressPosition.x) / transitionView.width
+ return -(centroid.position.y - centroid.pressPosition.y) / transitionView.height
+ }
+
+ onActiveChanged: {
+ if (handler.active) {
+ if (distance() < 0)
+ transitionView.nextItem = list.nextItem
+ else
+ transitionView.nextItem = list.prevItem
+
+ transitionView.scheduleTransition()
+ if (transitionView.currentTransition)
+ transitionView.currentTransition.effect.enable()
+ } else {
+ var p = Math.abs(distance()) * 100
+ if (transitionView.currentTransition && transitionView.currentTransition.effect.progress > root.threshold) {
+ root.__activeItem = transitionView.nextItem
+ root.__reactToTransition = true
+ transitionView.currentTransition.__start()
+ } else { /* Drag was released, but threshold was not passed */
+ if (transitionView.currentTransition)
+ transitionView.currentTransition.effect.abort()
+ }
+ /* Block for 100ms */
+ handler.enabled = false
+ blocker.start()
+ }
+ }
+
+ onCentroidChanged: {
+ if (!handler.enabled)
+ return
+
+ var p = Math.abs(distance()) * 100
+
+ if (transitionView.currentTransition)
+ transitionView.currentTransition.effect.progress = p * 2
+ }
+ }
+}
diff --git a/examples/imports/TransitionView/TransitionList.qml b/examples/imports/TransitionView/TransitionList.qml
new file mode 100644
index 0000000..4e617c7
--- /dev/null
+++ b/examples/imports/TransitionView/TransitionList.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+QtObject {
+ id: list
+ property Item intialItem
+ //has next prev and most likely currentIndex, count
+ property var items
+
+ property Item nextItem
+ property Item prevItem
+
+ property Item currentItem
+
+ onCurrentItemChanged: {
+
+ var currentIndex = list.__indexForCurrentItem()
+
+ if (currentIndex < (list.items.length - 1))
+ list.nextItem = list.items[currentIndex + 1]
+ if (currentIndex > 0)
+ list.prevItem = list.items[currentIndex - 1]
+
+ }
+
+ function __indexForCurrentItem() {
+ var currentIndex = -1
+ for (var i = 0; i < list.items.length; ++i) {
+ var item = list.items[i]
+ if (item === list.currentItem)
+ currentIndex = i
+ }
+ return currentIndex
+ }
+
+ property int length: items.length
+
+ function next() {
+ var currentIndex = list.__indexForCurrentItem()
+
+ list.nextItem = null
+
+ if (currentIndex > -1 && (currentIndex < list.items.length - 1)) {
+ list.prevItem = list.items[currentIndex]
+ list.currentItem = list.items[currentIndex + 1]
+ if (currentIndex + 2 < list.items.length)
+ list.nextItem = list.items[currentIndex + 2]
+ }
+ }
+
+ function prev() {
+ var currentIndex = list.__indexForCurrentItem()
+
+ list.prevItem = null
+
+ if (currentIndex > 0 && currentIndex < (list.items.length)) {
+ if (currentIndex - 2 >= 0)
+ list.prevItem = list.items[currentIndex - 2]
+ list.currentItem = list.items[currentIndex - 1]
+
+ list.nextItem = list.items[currentIndex]
+ }
+ }
+
+ Component.onCompleted: {
+ list.currentItem = list.intialItem
+ var currentIndex = list.__indexForCurrentItem()
+ if (currentIndex < (list.items.length - 1))
+ list.nextItem = list.items[currentIndex + 1]
+ if (currentIndex > 0)
+ list.prevItem = list.items[currentIndex - 1]
+ }
+}
diff --git a/examples/imports/TransitionView/TransitionView.qml b/examples/imports/TransitionView/TransitionView.qml
new file mode 100644
index 0000000..1f4576a
--- /dev/null
+++ b/examples/imports/TransitionView/TransitionView.qml
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Quick Designer Components.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import TransitionItem 1.0
+
+Item {
+ id: root
+ width: 200
+ height: 200
+
+ property PageTransition defaultTransition
+
+ property PageTransition currentTransition
+
+ property PageTransition __forceTransition
+
+ property list<PageTransition> transitions
+
+ property Item interaction: Item {
+ }
+
+ enum EffectEnum {
+ Instant,
+ Dissolve,
+ Fade,
+ Pop
+ }
+
+ default property alias item: stack.children
+
+ property Item nextItem
+
+ property Item currentItem
+ property Item activatedItem
+ property Item lastItem
+ property int currentIndex: 0
+
+ property int maxIndex: 0
+
+ signal transitionFinished
+
+ property alias __stack: stack
+
+ Item {
+ id: stack
+ visible: false
+ }
+
+ property bool __isCompleted: false
+
+ property real progress: 0
+
+ property bool __blockSchedule: false
+
+ onActivatedItemChanged: {
+ if (!__isCompleted)
+ return
+
+ if (root.activatedItem === root.currentItem)
+ return;
+
+ root.nextItem = root.activatedItem
+
+ for (var i = 0; i < root.allChildren.length; ++i) {
+ if (root.allChildren[i] === root.activatedItem)
+ root.currentIndex = i
+ }
+ }
+
+ function resetCurrentIndex() {
+ root.__blockSchedule = true
+ root.lastItem = root.currentItem
+ //root.currentItem = root.nextItem
+ for (var i = 0; i < root.allChildren.length; ++i) {
+ if (root.allChildren[i] === root.currentItem)
+ root.currentIndex = i
+ }
+ root.__blockSchedule = false
+ }
+
+ Component.onCompleted: {
+ root.maxIndex = stack.children.length - 1
+
+ root.allChildren = []
+
+ for (var i = 0; i < stack.children.length; ++i) {
+ root.allChildren.push(stack.children[i])
+ }
+
+ /* Assign view to all transitions */
+ if (defaultTransition) {
+ defaultTransition.transitionView = root
+ }
+
+ for (i = 0; i < root.transitions.length; ++i) {
+ var t = root.transitions[i]
+ t.transitionView = root
+ }
+
+ __setupCurrentItem()
+ __isCompleted = true
+ }
+
+ function scheduleTransition()
+ {
+ root.progress = 0
+
+ var pageTransition = null
+
+ /* find correct transition */
+ for (var i = 0; i < root.transitions.length; ++i) {
+ var t = root.transitions[i]
+ if ((t.from === root.currentItem) && (t.to === root.nextItem)) {
+ pageTransition = t
+ }
+ }
+
+ if (pageTransition !== null) {
+
+ } else {
+ pageTransition = root.defaultTransition
+ }
+
+ if (root.currentTransition)
+ root.currentTransition.__stop()
+
+ /* If a specific transition is forced then use this one. */
+ if (__forceTransition)
+ pageTransition = __forceTransition
+ __forceTransition = null
+
+ root.currentTransition = pageTransition
+ if (root.currentTransition)
+ root.currentTransition.__reset(root.currentItem, root.nextItem)
+
+ root.progress = Qt.binding(function () {
+ if (root.currentTransition)
+ return root.currentTransition.progress
+ return 0
+ })
+ }
+
+ onCurrentIndexChanged: {
+ root.nextItem = root.allChildren[root.currentIndex]
+
+ if (root.nextItem === root.currentItem)
+ return
+
+ if (root.__blockSchedule)
+ return
+
+
+ scheduleTransition()
+
+ root.lastItem = root.currentItem
+
+ root.currentTransition.__start()
+ }
+
+ function __setupCurrentItem() {
+ if (root.currentItem)
+ root.currentItem.parent = stack
+
+ if (root.nextItem)
+ root.currentItem = root.nextItem
+ else
+ root.currentItem = root.allChildren[root.currentIndex]
+
+
+ root.currentItem.parent = root
+ root.currentTransition = null
+ transitionFinished()
+ }
+
+ function gotoPage(transition) {
+ var page = transition.page
+ /* There might be another transition that fits. We are forcing this one. */
+ __forceTransition = transition
+ for (var i = 0; i < root.allChildren.length; ++i) {
+ if (page === root.allChildren[i]) {
+ root.currentIndex = i
+ }
+ }
+ }
+
+ property var allChildren
+
+ property Item __fromContentItem: Item {
+ width: root.width
+ height: root.height
+ parent: root
+ }
+
+ property Item __toContentItem: Item {
+ width: root.width
+ height: root.height
+ parent: root
+ }
+}
diff --git a/examples/imports/TransitionView/qmldir b/examples/imports/TransitionView/qmldir
new file mode 100644
index 0000000..11bf275
--- /dev/null
+++ b/examples/imports/TransitionView/qmldir
@@ -0,0 +1,15 @@
+DefaultPageEffect 1.0 DefaultPageEffect.qml
+SwipeInteraction 1.0 SwipeInteraction.qml
+PageEffect 1.0 PageEffect.qml
+PageFadeEffect 1.0 PageFadeEffect.qml
+PagePushLeftEffect 1.0 PagePushLeftEffect.qml
+PagePushRightEffect 1.0 PagePushRightEffect.qml
+PageSlideDownEffect 1.0 PageSlideDownEffect.qml
+PageSlideLeftEffect 1.0 PageSlideLeftEffect.qml
+PageSlideRightEffect 1.0 PageSlideRightEffect.qml
+PageSlideUpEffect 1.0 PageSlideUpEffect.qml
+PageTransition 1.0 PageTransition.qml
+TransitionList 1.0 TransitionList.qml
+TransitionView 1.0 TransitionView.qml
+PagePushUpEffect 1.0 PagePushUpEffect.qml
+