summaryrefslogtreecommitdiffstats
path: root/QtDemo/qml/QtDemo/Element.qml
blob: 9936fb204bd6207f31336c83c24a9bc993f91082 (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
import QtQuick 2.0

Item {
    id: root
    width: 1
    height: 1

    property int itemId : 1

    Image {
        id: elementImage
        anchors.centerIn: root
        z: 5
    }

    Component.onCompleted: {
        elementImage.source = root.itemId === 0 ? "images/man1.png" :
                              root.itemId === 1 ? "images/tree1.png" :
                              root.itemId === 2 ? "images/tree2.png" :
                              root.itemId === 3 ? "images/mountain.png" :
                              root.itemId === 4 ? "images/stones.png" :
                              root.itemId === 5 ? "images/box_open.png" :
                              root.itemId === 6 ? "images/box.png" :
                              ""
    }
}