Created
March 16, 2023 04:25
-
-
Save FONQRI/09cddbeee2ea6eb2794dd6108656ab97 to your computer and use it in GitHub Desktop.
Triangle.qml for tutorial in moderncpp.ir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RectangleExample.qml | |
import QtQuick 2.5 | |
// The root element is the Rectangle | |
Rectangle { | |
// name this element root | |
id: root | |
// properties: <name>: <value> | |
width: 120; height: 240 | |
// color property | |
color: "#4A4A4A" | |
// Declare a nested element (child of root) | |
Image { | |
id: triangle | |
// reference the parent | |
x: (parent.width - width)/2; y: 40 | |
source: 'assets/triangle_red.png' | |
} | |
// Another child of root | |
Text { | |
// un-named element | |
// reference element by id | |
y: triangle.y + triangle.height + 20 | |
// reference root element | |
width: root.width | |
color: 'white' | |
horizontalAlignment: Text.AlignHCenter | |
text: 'Triangle' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment