Skip to content

Instantly share code, notes, and snippets.

@ultramcu
Created July 1, 2013 14:28
Show Gist options
  • Save ultramcu/5901305 to your computer and use it in GitHub Desktop.
Save ultramcu/5901305 to your computer and use it in GitHub Desktop.
QML Objects ID and Navigating the Objects Tree
/*
Objects ID and Navigating the Objects Tree
Author : MaIII Themd
Website : http://miiniq.blogspot.com
FB : http://www.facebook.com/PiShared
Env : Qt 5.0.2 clang 64 bit OSX 10.8.4
*/
import QtQuick 2.0
Rectangle {
id : rec_main;
width: 500
height:300
color: "blue"
Text{
text :"Layer 1"
anchors.centerIn: parent;
}
Rectangle {
id : rec_2;
width: parent.width;
height: parent.height/3;
x:0;y:0;
color:"white";
Text{
text :"Layer 2"
anchors.bottom: parent.bottom;
anchors.bottomMargin: parent.height/4;
anchors.horizontalCenter: parent.horizontalCenter;
}
Rectangle {
id : rec_2_1;
width: parent.width;
height: parent.height/2;
x:0;y:0;
color:"red";
Text{
text :"Layer 3"
anchors.centerIn: parent;
}
}
}
Rectangle {
id : rec_3;
width: rec_main.width;
height: rec_main.height/3;
x:0;y:(rec_main.height/3) * 2;
color:"white";
Text{
text :"Layer 2"
anchors.top: parent.top;
anchors.topMargin: parent.height/4;
anchors.horizontalCenter: parent.horizontalCenter;
}
Rectangle {
id : rec_3_1;
width: rec_3.width;
height: rec_3.height/2;
x:0;y:rec_3.height/2;
color:"red";
Text{
text :"Layer 3"
anchors.centerIn: parent;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment