diff options
Diffstat (limited to 'QtDemo/qml/QtDemo/Element.qml')
-rw-r--r-- | QtDemo/qml/QtDemo/Element.qml | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/QtDemo/qml/QtDemo/Element.qml b/QtDemo/qml/QtDemo/Element.qml index 5c4426d..9936fb2 100644 --- a/QtDemo/qml/QtDemo/Element.qml +++ b/QtDemo/qml/QtDemo/Element.qml @@ -2,26 +2,25 @@ import QtQuick 2.0 Item { id: root + width: 1 + height: 1 property int itemId : 1 - property int posX: 0 - property int posY: 0 - property int itemWidth: 50 Image { id: elementImage - anchors.fill: root + anchors.centerIn: root z: 5 } Component.onCompleted: { - root.width = root.itemWidth - root.height = root.itemId == 2 ? root.itemWidth*0.8 : root.itemWidth*1.3 - root.x = root.posX - root.width/2 - root.y = root.posY - root.height/2 - elementImage.source = root.itemId === 0 ? "images/tree1.png" : - root.itemId === 1 ? "images/tree2.png" : - root.itemId === 2 ? "images/stones.png" : + 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" : "" } } |