blob: 4e1e3bc67e6c9432f7151754160c0c7ab7c356c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
// Copyright (C) 2026 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
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
}
}
}
}
}
|