Inital commit of the Komplex Hub
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 FlowView 1.0
|
||||
|
||||
Item {
|
||||
id: flowItem
|
||||
|
||||
width: 400
|
||||
height: 400
|
||||
|
||||
property var flowView: Item {}
|
||||
|
||||
property string __designer_url__
|
||||
|
||||
property alias loaderSource: loader.source
|
||||
|
||||
property var stateChangeTarget
|
||||
|
||||
property string defaultState
|
||||
|
||||
clip: true
|
||||
|
||||
function setState(state) {
|
||||
|
||||
}
|
||||
|
||||
onStateChangeTargetChanged: {
|
||||
loader.source = stateChangeTarget['__designer_url__']
|
||||
loader.item.state = flowItem.targetState
|
||||
flowItem.width = flowItem.stateChangeTarget.width
|
||||
flowItem.height = flowItem.stateChangeTarget.height
|
||||
}
|
||||
|
||||
|
||||
property string targetState
|
||||
|
||||
onTargetStateChanged: {
|
||||
loader.active = false
|
||||
loader.active = true
|
||||
loader.item.state = flowItem.targetState
|
||||
}
|
||||
|
||||
Text {
|
||||
text: flowItem.targetState
|
||||
}
|
||||
|
||||
property bool active: false
|
||||
|
||||
|
||||
function init() {
|
||||
flowItem.defaultState = flowItem.state
|
||||
if (FlowState.loading)
|
||||
return
|
||||
|
||||
if (loader.source == "")
|
||||
return
|
||||
|
||||
FlowState.loading = true
|
||||
flowItem.active = true
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
active: flowItem.active
|
||||
onLoaded: {
|
||||
flowItem.width = loader.item.childrenRect.width
|
||||
flowItem.height = loader.item.childrenRect.height
|
||||
FlowState.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 200
|
||||
height: 200
|
||||
|
||||
property FlowTransition defaultTransition
|
||||
|
||||
property FlowTransition currentTransition
|
||||
|
||||
property FlowTransition __forceTransition
|
||||
|
||||
property list<FlowTransition> flowTransitions
|
||||
property list<FlowDecision> flowDecisions
|
||||
property list<FlowWildcard> flowWildcards
|
||||
|
||||
property Item interaction: Item {
|
||||
}
|
||||
|
||||
enum EffectEnum {
|
||||
Instant,
|
||||
Dissolve,
|
||||
Fade,
|
||||
Pop
|
||||
}
|
||||
|
||||
property bool __blockHistory: false
|
||||
|
||||
property bool __isFlowView: true
|
||||
|
||||
function goBack() {
|
||||
if (root.__history.length === 0)
|
||||
return
|
||||
|
||||
var poppedItem = root.__history.pop()
|
||||
|
||||
root.__blockHistory = true
|
||||
root.activatedItem = poppedItem
|
||||
root.__activateItem()
|
||||
root.__blockHistory = false
|
||||
|
||||
|
||||
if (root.__history.length > 0)
|
||||
root.lastItem = root.__history.slice(-1)[0]
|
||||
else
|
||||
root.lastItem = null
|
||||
}
|
||||
|
||||
function __activateItem() {
|
||||
if (!__isCompleted)
|
||||
return
|
||||
|
||||
if (root.activatedItem === root.currentItem)
|
||||
return;
|
||||
|
||||
if (root.activatedItem === root.nextItem)
|
||||
return;
|
||||
|
||||
root.nextItem = root.activatedItem
|
||||
|
||||
for (var i = 0; i < root.allChildren.length; ++i) {
|
||||
if (root.allChildren[i] === root.activatedItem)
|
||||
root.currentIndex = i
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default property alias item: stack.data
|
||||
|
||||
property Item nextItem
|
||||
|
||||
property Item currentItem
|
||||
property Item activatedItem
|
||||
property Item lastItem
|
||||
property int currentIndex: 0
|
||||
|
||||
//property list<Item> __history
|
||||
property var __history: []
|
||||
|
||||
property int maxIndex: 0
|
||||
|
||||
signal transitionFinished
|
||||
|
||||
property alias __stack: stack
|
||||
|
||||
Item {
|
||||
id: stack
|
||||
visible: true
|
||||
}
|
||||
|
||||
property bool __isCompleted: false
|
||||
|
||||
property real progress: 0
|
||||
|
||||
property bool __blockSchedule: false
|
||||
|
||||
onActivatedItemChanged: {
|
||||
root.__activateItem()
|
||||
}
|
||||
|
||||
function resetCurrentIndex() {
|
||||
root.__blockSchedule = true
|
||||
root.lastItem = root.currentItem
|
||||
root.__history.push(root.lastItem)
|
||||
|
||||
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])
|
||||
if (stack.children[i].flowView !== undefined) {
|
||||
stack.children[i].flowView = root
|
||||
stack.children[i].init()
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign view to all flowTransitions */
|
||||
if (defaultTransition) {
|
||||
defaultTransition.transitionView = root
|
||||
}
|
||||
|
||||
for (i = 0; i < root.flowWildcards.length; ++i) {
|
||||
var w = root.flowWildcards[i]
|
||||
w.transitionView = root
|
||||
}
|
||||
|
||||
var t
|
||||
|
||||
for (i = 0; i < root.flowTransitions.length; ++i) {
|
||||
t = root.flowTransitions[i]
|
||||
t.transitionView = root
|
||||
}
|
||||
|
||||
for (i = 0; i < root.flowTransitions.length; ++i) {
|
||||
t = root.flowTransitions[i]
|
||||
if (root.checkInclude(t.from, root)) {
|
||||
root.currentItem = t.to[0]
|
||||
if (root.currentItem.stateChangeTarget !== undefined) {
|
||||
root.currentItem.stateChangeTarget.setState(root.currentItem.targetState)
|
||||
root.currentItem = root.currentItem.stateChangeTarget
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
root.resetCurrentIndex()
|
||||
|
||||
__setupCurrentItem()
|
||||
__isCompleted = true
|
||||
}
|
||||
|
||||
function checkInclude(list, item)
|
||||
{
|
||||
for (var i = 0; i < list.length; ++i) {
|
||||
if (list[i] === item)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function scheduleTransition()
|
||||
{
|
||||
root.progress = 0
|
||||
|
||||
var pageTransition = null
|
||||
|
||||
/* find correct transition */
|
||||
for (var i = 0; i < root.flowTransitions.length; ++i) {
|
||||
var t = root.flowTransitions[i]
|
||||
if (checkInclude(t.from, root.currentItem) && checkInclude(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
|
||||
|
||||
if (root.nextItem.stateChangeTarget !== undefined) {
|
||||
var itemVar = root.nextItem.stateChangeTarget
|
||||
var stateVar = root.nextItem.targetState
|
||||
itemVar.state = stateVar
|
||||
for (var i = 0; i < root.allChildren.length; ++i) {
|
||||
if (root.allChildren[i] === itemVar)
|
||||
root.currentIndex = i
|
||||
}
|
||||
}
|
||||
|
||||
scheduleTransition()
|
||||
|
||||
if (!root.__blockHistory) {
|
||||
root.lastItem = root.currentItem
|
||||
if (!Array.isArray(root.__history))
|
||||
root.__history = []
|
||||
|
||||
root.__history.push(root.lastItem)
|
||||
}
|
||||
|
||||
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.to[0]
|
||||
/* 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
set_source_files_properties(FlowState.qml
|
||||
PROPERTIES
|
||||
QT_QML_SINGLETON_TYPE true
|
||||
)
|
||||
|
||||
qt_add_library(FlowView STATIC)
|
||||
qt6_add_qml_module(FlowView
|
||||
URI "FlowView"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
RESOURCE_PREFIX "/qt-project.org/imports"
|
||||
DESIGNER_SUPPORTED
|
||||
PAST_MAJOR_VERSIONS 1
|
||||
${qds_qml_extra_args}
|
||||
NO_GENERATE_QMLDIR
|
||||
NO_LINT
|
||||
NO_CACHEGEN
|
||||
QML_FILES
|
||||
DefaultFlowEffect.qml
|
||||
SwipeInteraction.qml
|
||||
FlowEffect.qml
|
||||
FlowFadeEffect.qml
|
||||
FlowPushLeftEffect.qml
|
||||
FlowPushRightEffect.qml
|
||||
FlowSlideDownEffect.qml
|
||||
FlowSlideLeftEffect.qml
|
||||
FlowSlideRightEffect.qml
|
||||
FlowSlideUpEffect.qml
|
||||
FlowMoveEffect.qml
|
||||
FlowPushEffect.qml
|
||||
FlowTransition.qml
|
||||
FlowTransitionList.qml
|
||||
FlowView.qml
|
||||
FlowPushUpEffect.qml
|
||||
FlowItem.qml
|
||||
FlowDecision.qml
|
||||
FlowWildcard.qml
|
||||
FlowActionArea.qml
|
||||
FlowState.qml
|
||||
+DesignMode/FlowItem.qml
|
||||
+DesignMode/FlowView.qml
|
||||
RESOURCES
|
||||
qmldir
|
||||
)
|
||||
|
||||
register_plugin(FlowView)
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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.15
|
||||
|
||||
FlowEffect {
|
||||
//No Effect
|
||||
duration: 0
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Studio.EventSystem 1.0
|
||||
|
||||
Item {
|
||||
width: 80
|
||||
height: 40
|
||||
|
||||
id: root
|
||||
|
||||
enum ActionType{
|
||||
LeftPress = 0,
|
||||
LeftDoublePress = 1,
|
||||
LeftLongPress = 2,
|
||||
RightPress = 3,
|
||||
RightDoublePress = 4,
|
||||
RightLongPress = 5,
|
||||
FlickUp = 6,
|
||||
FlickDown = 7,
|
||||
FlickLeft = 8,
|
||||
FlickRight = 9,
|
||||
PinchIn = 10,
|
||||
PinchOut = 11
|
||||
}
|
||||
|
||||
Item {
|
||||
id: priv
|
||||
|
||||
property double dragStartTime;
|
||||
property point dragStartPoint;
|
||||
}
|
||||
|
||||
signal triggered
|
||||
|
||||
property real maxDragTime: 500
|
||||
property real minDragDistance: 50
|
||||
property real minPinchFactor: 2.0
|
||||
|
||||
property int eventType: FlowActionArea.LeftPress
|
||||
|
||||
TapHandler {
|
||||
enabled: (root.eventType >= FlowActionArea.LeftPress && root.eventType <= FlowActionArea.LeftLongPress)
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onTapped: if (root.eventType === FlowActionArea.LeftPress) { root.trigger(); }
|
||||
onDoubleTapped: if (root.eventType === FlowActionArea.LeftDoublePress) { root.trigger(); }
|
||||
onLongPressed: if (root.eventType === FlowActionArea.LeftLongPress) { root.trigger(); }
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
enabled: (root.eventType >= FlowActionArea.RightPress && root.eventType <= FlowActionArea.RightLongPress)
|
||||
acceptedButtons: Qt.RightButton
|
||||
onTapped: if (root.eventType === FlowActionArea.RightPress) { root.trigger(); }
|
||||
onDoubleTapped: if (root.eventType === FlowActionArea.RightDoublePress) { root.trigger(); }
|
||||
onLongPressed: if (root.eventType === FlowActionArea.RightLongPress) { root.trigger(); }
|
||||
}
|
||||
|
||||
PointHandler {
|
||||
enabled: (root.eventType >= FlowActionArea.FlickUp && root.eventType <= FlowActionArea.FlickRight)
|
||||
target: null
|
||||
|
||||
onActiveChanged: {
|
||||
if (active) {
|
||||
priv.dragStartTime = Date.now();
|
||||
priv.dragStartPoint = point.position;
|
||||
} else {
|
||||
var time = Date.now() - priv.dragStartTime;
|
||||
var distance = root.moveDistance(priv.dragStartPoint, point.position);
|
||||
if (time < root.maxDragTime && distance > root.minDragDistance){
|
||||
var angle = root.moveAngle(priv.dragStartPoint, point.position);
|
||||
|
||||
switch (root.eventType){
|
||||
case FlowActionArea.FlickUp:
|
||||
if (angle > 2.618 || angle < -2.618) {
|
||||
root.trigger();
|
||||
}
|
||||
break;
|
||||
case FlowActionArea.FlickDown:
|
||||
if (angle < 0.524 && angle > -0.524) {
|
||||
root.trigger();
|
||||
}
|
||||
break;
|
||||
case FlowActionArea.FlickLeft:
|
||||
if (angle < -1.047 && angle > -2.094) {
|
||||
root.trigger();
|
||||
}
|
||||
break;
|
||||
case FlowActionArea.FlickRight:
|
||||
if (angle < 2.094 && angle > 1.047) {
|
||||
root.trigger();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PinchHandler {
|
||||
enabled: (root.eventType === FlowActionArea.PinchIn || root.eventType === FlowActionArea.PinchOut)
|
||||
target: null
|
||||
|
||||
onActiveChanged: {
|
||||
if (active) {
|
||||
priv.dragStartTime = Date.now();
|
||||
} else {
|
||||
var time = Date.now() - priv.dragStartTime;
|
||||
if (time < root.maxDragTime) {
|
||||
if (root.eventType === FlowActionArea.PinchIn && activeScale < (1.0 / root.minPinchFactor)) {
|
||||
root.trigger();
|
||||
} else if (root.eventType === FlowActionArea.PinchOut && activeScale > root.minPinchFactor) {
|
||||
root.trigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function moveDistance(start, end){
|
||||
var x = end.x - start.x;
|
||||
var y = end.y - start.y;
|
||||
return Math.sqrt(x*x+y*y);
|
||||
}
|
||||
|
||||
function moveAngle(start, end){
|
||||
var x = end.x - start.x;
|
||||
var y = end.y - start.y;
|
||||
return Math.atan2(x,y);
|
||||
}
|
||||
|
||||
function trigger() {
|
||||
|
||||
var one = root.activeState
|
||||
var two = root.parent.state
|
||||
|
||||
if (one !== two)
|
||||
return
|
||||
|
||||
if (root.goBack) {
|
||||
var par = root.parent
|
||||
while (par) {
|
||||
if (par.__isFlowView) {
|
||||
par.goBack()
|
||||
return
|
||||
}
|
||||
par = par.parent
|
||||
}
|
||||
} else {
|
||||
target.trigger()
|
||||
}
|
||||
|
||||
root.triggered()
|
||||
}
|
||||
|
||||
property Connections connections : Connections {
|
||||
id: connections
|
||||
}
|
||||
|
||||
property QtObject target
|
||||
|
||||
readonly property bool isActionArea: true
|
||||
property bool fromStateChange: false
|
||||
|
||||
property string activeState: ""
|
||||
|
||||
enabled: (target !== null || root.goBack) && (root.activeState === root.parent.state)
|
||||
|
||||
property bool goBack: false
|
||||
|
||||
property alias eventIds: eventListener.eventIds
|
||||
|
||||
function __receiveEvent(parameters) {
|
||||
var flowItem = root.parent
|
||||
var flow = flowItem.parent
|
||||
|
||||
if (flow.currentItem !== flowItem)
|
||||
return;
|
||||
|
||||
root.trigger()
|
||||
}
|
||||
|
||||
EventListener {
|
||||
id: eventListener
|
||||
onTriggered: root.__receiveEvent(parameters)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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.15
|
||||
import QtQuick.Window 2.14
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property list<FlowTransition> targets
|
||||
|
||||
readonly property bool isFlowDecision: true
|
||||
|
||||
property string dialogTitle: qsTr("Title")
|
||||
|
||||
function trigger() {
|
||||
var hasDialog = false
|
||||
for (var i = 0; i < root.targets.length; ++i) {
|
||||
if (root.targets[i].question !== "")
|
||||
hasDialog = true
|
||||
}
|
||||
|
||||
if (hasDialog) {
|
||||
loader.show()
|
||||
}
|
||||
}
|
||||
|
||||
property Loader loader: Loader {
|
||||
active: false
|
||||
function show() {
|
||||
active = true
|
||||
item.show()
|
||||
item.raise()
|
||||
item.requestActivate()
|
||||
}
|
||||
|
||||
sourceComponent: windowComponent
|
||||
}
|
||||
|
||||
property Component windowComponent: Component {
|
||||
|
||||
Window {
|
||||
|
||||
id: dialog
|
||||
|
||||
title: root.dialogTitle
|
||||
modality: Qt.WindowModal
|
||||
transientParent: root.Window.window
|
||||
|
||||
width: 400
|
||||
height: column.height
|
||||
|
||||
minimumWidth: 400
|
||||
minimumHeight: 100
|
||||
flags: Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.WindowTitleHint
|
||||
|
||||
Rectangle {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
|
||||
ScrollView {
|
||||
anchors.fill: parent
|
||||
|
||||
|
||||
Column {
|
||||
id: column
|
||||
Repeater {
|
||||
model: targets
|
||||
Rectangle {
|
||||
visible: root.targets[index].question !== ""
|
||||
width: background.width
|
||||
height: 20
|
||||
opacity: mouseArea.containsMouse ? 1 : 0.8
|
||||
color: index / 2 ? "#ebecf0" : "white"
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
root.targets[index].__decisionTrigger()
|
||||
loader.item.close()
|
||||
loader.active = false
|
||||
}
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Text {
|
||||
height: 20
|
||||
text: root.targets[index].question
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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.15
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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
|
||||
|
||||
Item {
|
||||
id: flowItem
|
||||
|
||||
width: 400
|
||||
height: 400
|
||||
|
||||
property var flowView: Item {}
|
||||
|
||||
property alias loaderSource: loader.source
|
||||
|
||||
property var stateChangeTarget
|
||||
|
||||
property string targetState
|
||||
|
||||
property string defaultState: undefined
|
||||
|
||||
property bool forceActive: false
|
||||
|
||||
property bool __isFlowItem: true
|
||||
|
||||
function setState(newState) {
|
||||
flowItem.state = newState
|
||||
}
|
||||
|
||||
property bool active: {
|
||||
if (flowItem.forceActive)
|
||||
return true;
|
||||
if (flowItem.flowView !== null
|
||||
&& flowItem.flowView.currentItem !== undefined
|
||||
&& flowItem.flowView.currentItem === flowItem)
|
||||
return true
|
||||
|
||||
if (flowItem.flowView !== null
|
||||
&& flowItem.flowView.nextItem !== undefined
|
||||
&& flowItem.flowView.nextItem === flowItem)
|
||||
return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
active: flowItem.active
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
flowItem.x = 0
|
||||
flowItem.y = 0
|
||||
|
||||
flowItem.defaultState = flowItem.state
|
||||
var itemVar
|
||||
var i
|
||||
|
||||
if (flowItem.stateChangeTarget === undefined) {
|
||||
|
||||
for (i = 0; i < flowItem.children.length; ++i) {
|
||||
itemVar = flowItem.children[i]
|
||||
if (itemVar.isActionArea === true
|
||||
&& !itemVar.fromStateChange) {
|
||||
itemVar.activeState = flowItem.state
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
var childNum = flowItem.children.length
|
||||
var childArray = []
|
||||
|
||||
for (i = 0; i < flowItem.children.length; ++i) {
|
||||
childArray.push(flowItem.children[i])
|
||||
}
|
||||
|
||||
for (i = 0; i < childNum; ++i) {
|
||||
itemVar = childArray[i]
|
||||
|
||||
if (itemVar.isActionArea === true) {
|
||||
itemVar.fromStateChange = true
|
||||
itemVar.activeState = flowItem.targetState
|
||||
itemVar.parent = flowItem.stateChangeTarget
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
id: effect
|
||||
|
||||
property real itemHeight: transitionView.height
|
||||
property int direction: 0
|
||||
//left, right, up, down
|
||||
|
||||
duration: 250
|
||||
onStarted: {
|
||||
group01.target = effect.transitionView.__toContentItem
|
||||
group02.target = effect.transitionView.__toContentItem
|
||||
}
|
||||
|
||||
timeline: Timeline {
|
||||
startFrame: 0
|
||||
endFrame: 1000
|
||||
|
||||
KeyframeGroup {
|
||||
id: group01
|
||||
|
||||
property: "x"
|
||||
|
||||
Keyframe {
|
||||
frame: 0
|
||||
|
||||
value: {
|
||||
if (effect.direction === 0)
|
||||
return -effect.transitionView.width
|
||||
if (effect.direction === 1)
|
||||
return effect.transitionView.width
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
Keyframe {
|
||||
frame: 1000
|
||||
value: 0
|
||||
easing: effect.easing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
KeyframeGroup {
|
||||
id: group02
|
||||
|
||||
property: "y"
|
||||
|
||||
Keyframe {
|
||||
frame: 0
|
||||
|
||||
value: {
|
||||
if (effect.direction === 2)
|
||||
return -effect.itemHeight
|
||||
if (effect.direction === 3)
|
||||
return effect.itemHeight
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
Keyframe {
|
||||
frame: 1000
|
||||
value: 0
|
||||
easing: effect.easing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
id: effect
|
||||
|
||||
property real scale: 1
|
||||
property real inOpacity: 1
|
||||
property real outOpacity: 1
|
||||
|
||||
property int direction: 0
|
||||
//left, right, up, down
|
||||
|
||||
property bool revealCurrent: false
|
||||
property int itemHeight: effect.transitionView.height
|
||||
|
||||
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
|
||||
group07.target = transitionView.__fromContentItem
|
||||
group08.target = transitionView.__toContentItem
|
||||
if (effect.revealCurrent)
|
||||
group01.target.z = 1
|
||||
}
|
||||
|
||||
timeline: Timeline {
|
||||
startFrame: 0
|
||||
endFrame: 1000
|
||||
|
||||
KeyframeGroup {
|
||||
id: group01
|
||||
|
||||
property: "x"
|
||||
|
||||
Keyframe {
|
||||
frame: 0
|
||||
value: 0
|
||||
}
|
||||
|
||||
Keyframe {
|
||||
frame: 1000
|
||||
value: {
|
||||
if (effect.direction === 0)
|
||||
return effect.transitionView.width
|
||||
if (effect.direction === 1)
|
||||
return -effect.transitionView.width
|
||||
return 0
|
||||
}
|
||||
easing: effect.easing
|
||||
}
|
||||
}
|
||||
|
||||
KeyframeGroup {
|
||||
id: group02
|
||||
|
||||
property: "x"
|
||||
|
||||
Keyframe {
|
||||
frame: 0
|
||||
value: {
|
||||
if (effect.revealCurrent)
|
||||
return 0
|
||||
if (effect.direction === 0)
|
||||
return -effect.transitionView.width
|
||||
if (effect.direction === 1)
|
||||
return effect.transitionView.width
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
KeyframeGroup {
|
||||
id: group07
|
||||
|
||||
property: "y"
|
||||
|
||||
Keyframe {
|
||||
frame: 0
|
||||
value: 0
|
||||
}
|
||||
|
||||
Keyframe {
|
||||
frame: 1000
|
||||
|
||||
value: {
|
||||
if (effect.direction === 2)
|
||||
return -effect.itemHeight
|
||||
if (effect.direction === 3)
|
||||
return effect.itemHeight
|
||||
return 0
|
||||
}
|
||||
|
||||
easing: effect.easing
|
||||
}
|
||||
}
|
||||
|
||||
KeyframeGroup {
|
||||
id: group08
|
||||
|
||||
property: "y"
|
||||
|
||||
Keyframe {
|
||||
frame: 0
|
||||
|
||||
value: {
|
||||
if (effect.revealCurrent)
|
||||
return 0
|
||||
if (effect.direction === 2)
|
||||
return effect.itemHeight
|
||||
if (effect.direction === 3)
|
||||
return -effect.itemHeight
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
Keyframe {
|
||||
frame: 1000
|
||||
value: 0
|
||||
easing: effect.easing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 QtQuick.Timeline 1.0
|
||||
|
||||
FlowEffect {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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$
|
||||
**
|
||||
****************************************************************************/
|
||||
pragma Singleton
|
||||
import QtQuick 2.15
|
||||
|
||||
QtObject {
|
||||
id: object
|
||||
|
||||
property bool loading: false
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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.15
|
||||
import QtQuick.Studio.EventSystem 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 list<QtObject> from
|
||||
property list<QtObject> to
|
||||
property int duration
|
||||
|
||||
property var transitionView: Item {}
|
||||
|
||||
property real progress: effect.progress
|
||||
|
||||
property bool condition: true
|
||||
|
||||
property string question
|
||||
|
||||
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 __checkInclude(list, item) {
|
||||
for (var i = 0; i < list.length; ++i) {
|
||||
if (list[i] === item)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
property alias eventIds: eventListener.eventIds
|
||||
|
||||
function __receiveEvent(parameters) {
|
||||
var flowItem = root.from[0]
|
||||
var flow = root.transitionView
|
||||
|
||||
if (flowItem.stateChangeTarget !== undefined
|
||||
&& flowItem.stateChangeTarget === flow.currentItem) {
|
||||
if (flowItem.targetState === flow.currentItem.state)
|
||||
flowItem = flowItem.stateChangeTarget
|
||||
}
|
||||
|
||||
if (flow.currentItem !== flowItem)
|
||||
return;
|
||||
|
||||
root.trigger()
|
||||
}
|
||||
|
||||
property EventListener eventListener: EventListener {
|
||||
id: eventListener
|
||||
onTriggered: root.__receiveEvent(parameters)
|
||||
}
|
||||
|
||||
function trigger() {
|
||||
var fromEmpty = root.from.length === 0
|
||||
|
||||
if (to[0].isFlowDecision === true)
|
||||
to[0].trigger();
|
||||
|
||||
var stateChanger = false
|
||||
|
||||
if (root.from[0] !== undefined)
|
||||
stateChanger = root.from[0].stateChangeTarget !== undefined
|
||||
|
||||
var toStateChanger = false
|
||||
|
||||
if (root.to[0] !== undefined)
|
||||
toStateChanger = root.to[0].stateChangeTarget !== undefined
|
||||
|
||||
if (!toStateChanger && root.to[0].defaultState !== undefined)
|
||||
root.to[0].state = root.to[0].defaultState
|
||||
|
||||
if (stateChanger || fromEmpty || __checkInclude(root.from, transitionView.currentItem))
|
||||
timer.restart()
|
||||
}
|
||||
|
||||
function __decisionTrigger() {
|
||||
/* Workaround for flowDecisions with multiple sources */
|
||||
if (!__checkInclude(root.from, transitionView.currentItem) && root.from.length !== 0)
|
||||
root.from = []
|
||||
root.trigger()
|
||||
}
|
||||
|
||||
property Timer timer: Timer {
|
||||
interval: 1
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered: transitionView.gotoPage(root)
|
||||
}
|
||||
|
||||
property FlowEffect effect: DefaultFlowEffect {
|
||||
transitionView: transitionView
|
||||
|
||||
}
|
||||
|
||||
onEffectChanged: {
|
||||
root.effect.transitionView = root.transitionView
|
||||
}
|
||||
|
||||
property Connections effectConnection: Connections {
|
||||
target: root.effect
|
||||
function onFinished() { root.finished() }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 200
|
||||
height: 200
|
||||
|
||||
property FlowTransition defaultTransition
|
||||
|
||||
property FlowTransition currentTransition
|
||||
|
||||
property FlowTransition __forceTransition
|
||||
|
||||
property list<FlowTransition> flowTransitions
|
||||
property list<FlowDecision> flowDecisions
|
||||
property list<FlowWildcard> flowWildcards
|
||||
|
||||
property Item interaction: Item {
|
||||
}
|
||||
|
||||
property bool __parentFlowChanged: false
|
||||
|
||||
enum EffectEnum {
|
||||
Instant,
|
||||
Dissolve,
|
||||
Fade,
|
||||
Pop
|
||||
}
|
||||
|
||||
property bool __blockHistory: false
|
||||
|
||||
property bool __isFlowView: true
|
||||
|
||||
function goBack() {
|
||||
if (root.__history.length === 0)
|
||||
return
|
||||
|
||||
if (root.__parentFlowChanged) {
|
||||
root.__parentFlowChanged = false
|
||||
parentFlowView().goBack()
|
||||
}
|
||||
|
||||
var poppedItem = root.__history.pop()
|
||||
|
||||
root.__blockHistory = true
|
||||
root.activatedItem = poppedItem
|
||||
root.__activateItem()
|
||||
root.__blockHistory = false
|
||||
|
||||
|
||||
if (root.__history.length > 0)
|
||||
root.lastItem = root.__history.slice(-1)[0]
|
||||
else
|
||||
root.lastItem = null
|
||||
}
|
||||
|
||||
function __activateItem() {
|
||||
if (!__isCompleted)
|
||||
return
|
||||
|
||||
if (root.activatedItem === root.currentItem)
|
||||
return;
|
||||
|
||||
if (root.activatedItem === root.nextItem)
|
||||
return;
|
||||
|
||||
root.nextItem = root.activatedItem
|
||||
|
||||
for (var i = 0; i < root.allChildren.length; ++i) {
|
||||
if (root.allChildren[i] === root.activatedItem)
|
||||
root.currentIndex = i
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function parentFlowView() {
|
||||
var par = root.parent
|
||||
while (par) {
|
||||
if (par.__isFlowView)
|
||||
return par
|
||||
par = par.parent
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function parentFlowItem() {
|
||||
var par = root.parent
|
||||
while (par) {
|
||||
if (par.__isFlowItem)
|
||||
return par
|
||||
par = par.parent
|
||||
}
|
||||
return null
|
||||
|
||||
}
|
||||
|
||||
default property alias item: stack.data
|
||||
|
||||
property Item nextItem
|
||||
|
||||
property Item currentItem
|
||||
property Item activatedItem
|
||||
property Item lastItem
|
||||
property int currentIndex: 0
|
||||
|
||||
//property list<Item> __history
|
||||
property var __history: []
|
||||
|
||||
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: {
|
||||
root.__activateItem()
|
||||
}
|
||||
|
||||
function resetCurrentIndex() {
|
||||
root.__blockSchedule = true
|
||||
root.lastItem = root.currentItem
|
||||
root.__history.push(root.lastItem)
|
||||
|
||||
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])
|
||||
if (stack.children[i].flowView !== undefined) {
|
||||
stack.children[i].flowView = root
|
||||
stack.children[i].init()
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign view to all flowTransitions */
|
||||
if (defaultTransition) {
|
||||
defaultTransition.transitionView = root
|
||||
}
|
||||
|
||||
for (i = 0; i < root.flowWildcards.length; ++i) {
|
||||
var w = root.flowWildcards[i]
|
||||
w.transitionView = root
|
||||
}
|
||||
|
||||
var t
|
||||
|
||||
for (i = 0; i < root.flowTransitions.length; ++i) {
|
||||
t = root.flowTransitions[i]
|
||||
t.transitionView = root
|
||||
}
|
||||
|
||||
for (i = 0; i < root.flowTransitions.length; ++i) {
|
||||
t = root.flowTransitions[i]
|
||||
if (root.checkInclude(t.from, root)) {
|
||||
root.currentItem = t.to[0]
|
||||
if (root.currentItem.stateChangeTarget !== undefined) {
|
||||
root.currentItem.stateChangeTarget.setState(root.currentItem.targetState)
|
||||
root.currentItem = root.currentItem.stateChangeTarget
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
root.resetCurrentIndex()
|
||||
|
||||
__setupCurrentItem()
|
||||
__isCompleted = true
|
||||
}
|
||||
|
||||
function checkInclude(list, item)
|
||||
{
|
||||
for (var i = 0; i < list.length; ++i) {
|
||||
if (list[i] === item)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function scheduleTransition()
|
||||
{
|
||||
root.progress = 0
|
||||
|
||||
var pageTransition = null
|
||||
|
||||
/* find correct transition */
|
||||
for (var i = 0; i < root.flowTransitions.length; ++i) {
|
||||
var t = root.flowTransitions[i]
|
||||
if (checkInclude(t.from, root.currentItem) && checkInclude(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
|
||||
|
||||
if (root.nextItem.stateChangeTarget !== undefined) {
|
||||
var itemVar = root.nextItem.stateChangeTarget
|
||||
var stateVar = root.nextItem.targetState
|
||||
itemVar.state = stateVar
|
||||
for (var i = 0; i < root.allChildren.length; ++i) {
|
||||
if (root.allChildren[i] === itemVar)
|
||||
root.currentIndex = i
|
||||
}
|
||||
}
|
||||
|
||||
scheduleTransition()
|
||||
|
||||
if (!root.__blockHistory) {
|
||||
root.lastItem = root.currentItem
|
||||
if (!Array.isArray(root.__history))
|
||||
root.__history = []
|
||||
|
||||
root.__history.push(root.lastItem)
|
||||
}
|
||||
|
||||
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.to[0]
|
||||
/* 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function gotoItem(item) {
|
||||
for (var i = 0; i < root.allChildren.length; ++i) {
|
||||
if (item === root.allChildren[i]) {
|
||||
root.currentIndex = i
|
||||
print("index " + 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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.15
|
||||
import QtQuick.Studio.EventSystem 1.0
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property list<FlowItem> positivelist
|
||||
property list<FlowItem> negativelist
|
||||
|
||||
default property list<QtObject> data
|
||||
|
||||
property FlowTransition target
|
||||
|
||||
property var transitionView: Item {}
|
||||
|
||||
property bool globalWildcard: false
|
||||
|
||||
function trigger() {
|
||||
var cItem = root.transitionView.currentItem
|
||||
|
||||
if (root.globalWildcard && root.transitionView.parentFlowView()) {
|
||||
root.transitionView.__parentFlowChanged = true
|
||||
root.transitionView.parentFlowView().gotoItem(root.transitionView.parentFlowItem())
|
||||
}
|
||||
|
||||
if (cItem === undefined)
|
||||
return
|
||||
|
||||
if (root.transitionView.checkInclude(root.negativelist, cItem))
|
||||
return;
|
||||
|
||||
if (root.positivelist.length !== 0) {
|
||||
if (!root.transitionView.checkInclude(root.positivelist, cItem))
|
||||
return;
|
||||
}
|
||||
|
||||
root.target.trigger()
|
||||
}
|
||||
|
||||
property EventListener eventListener: EventListener {
|
||||
id: eventListener
|
||||
onTriggered: root.trigger()
|
||||
}
|
||||
|
||||
property alias eventIds: eventListener.eventIds
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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
|
||||
function 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import QtQuick.tooling 1.2
|
||||
|
||||
// This file describes the plugin-supplied types contained in the library.
|
||||
// It is used for QML tooling purposes only.
|
||||
//
|
||||
// This file was auto-generated by:
|
||||
// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls 2.15'
|
||||
|
||||
Module {
|
||||
dependencies: [
|
||||
"QtQuick 2.11"
|
||||
]
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
module FlowView
|
||||
designersupported
|
||||
typeinfo FlowView.qmltypes
|
||||
DefaultFlowEffect 6.0 DefaultFlowEffect.qml
|
||||
DefaultFlowEffect 1.0 DefaultFlowEffect.qml
|
||||
SwipeInteraction 6.0 SwipeInteraction.qml
|
||||
SwipeInteraction 1.0 SwipeInteraction.qml
|
||||
FlowEffect 6.0 FlowEffect.qml
|
||||
FlowEffect 1.0 FlowEffect.qml
|
||||
FlowFadeEffect 6.0 FlowFadeEffect.qml
|
||||
FlowFadeEffect 1.0 FlowFadeEffect.qml
|
||||
FlowPushLeftEffect 6.0 FlowPushLeftEffect.qml
|
||||
FlowPushLeftEffect 1.0 FlowPushLeftEffect.qml
|
||||
FlowPushRightEffect 6.0 FlowPushRightEffect.qml
|
||||
FlowPushRightEffect 1.0 FlowPushRightEffect.qml
|
||||
FlowSlideDownEffect 6.0 FlowSlideDownEffect.qml
|
||||
FlowSlideDownEffect 1.0 FlowSlideDownEffect.qml
|
||||
FlowSlideLeftEffect 6.0 FlowSlideLeftEffect.qml
|
||||
FlowSlideLeftEffect 1.0 FlowSlideLeftEffect.qml
|
||||
FlowSlideRightEffect 6.0 FlowSlideRightEffect.qml
|
||||
FlowSlideRightEffect 1.0 FlowSlideRightEffect.qml
|
||||
FlowSlideUpEffect 6.0 FlowSlideUpEffect.qml
|
||||
FlowSlideUpEffect 1.0 FlowSlideUpEffect.qml
|
||||
FlowMoveEffect 6.0 FlowMoveEffect.qml
|
||||
FlowMoveEffect 1.0 FlowMoveEffect.qml
|
||||
FlowPushEffect 6.0 FlowPushEffect.qml
|
||||
FlowPushEffect 1.0 FlowPushEffect.qml
|
||||
FlowTransition 6.0 FlowTransition.qml
|
||||
FlowTransition 1.0 FlowTransition.qml
|
||||
FlowTransitionList 6.0 FlowTransitionList.qml
|
||||
FlowTransitionList 1.0 FlowTransitionList.qml
|
||||
FlowView 6.0 FlowView.qml
|
||||
FlowView 1.0 FlowView.qml
|
||||
FlowPushUpEffect 6.0 FlowPushUpEffect.qml
|
||||
FlowPushUpEffect 1.0 FlowPushUpEffect.qml
|
||||
FlowItem 6.0 FlowItem.qml
|
||||
FlowItem 1.0 FlowItem.qml
|
||||
FlowDecision 6.0 FlowDecision.qml
|
||||
FlowDecision 1.0 FlowDecision.qml
|
||||
FlowWildcard 6.0 FlowWildcard.qml
|
||||
FlowWildcard 1.0 FlowWildcard.qml
|
||||
FlowActionArea 6.0 FlowActionArea.qml
|
||||
FlowActionArea 1.0 FlowActionArea.qml
|
||||
singleton FlowState 6.0 FlowState.qml
|
||||
singleton FlowState 1.0 FlowState.qml
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QtStudioFlowViewPlugin: public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
|
||||
|
||||
public:
|
||||
QtStudioFlowViewPlugin(QObject *parent = nullptr);
|
||||
void registerTypes(const char *uri) override;
|
||||
};
|
||||
|
||||
QtStudioFlowViewPlugin::QtStudioFlowViewPlugin(QObject *parent)
|
||||
: QQmlExtensionPlugin(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QtStudioFlowViewPlugin::registerTypes(const char *)
|
||||
{
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "qtstudioflowviewplugin.moc"
|
||||
Reference in New Issue
Block a user