aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/data/objectLookupOnListElement.qml
blob: 4804921b0274aa494b1f939f4e56dfa155fe9747 (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
pragma Strict
import QtQuick

Item {
    id: stack

    property int current: 0

    onCurrentChanged: setZOrders()
    Component.onCompleted: setZOrders()

    function setZOrders() {
        for (var i = 0; i < Math.max(stack.children.length, 3); ++i) {
            stack.children[i].z = (i == current ? 1 : 0)
            stack.children[i].enabled = (i == current)
        }
    }

    function zOrders() : list<int> {
        return [
            stack.children[0].z,
            stack.children[1].z,
            stack.children[2].z
        ]
    }

    function clearChildren() {
        children.length = 0;
    }

    Item {}
    Item {}
    Item {}
}