Created
March 16, 2023 04:59
-
-
Save FONQRI/4a66509ce278c29939b2f9c1a9091cd8 to your computer and use it in GitHub Desktop.
Qt quick tutorial property text for 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
Text { | |
// (1) identifier | |
id: thisLabel | |
// (2) set x- and y-position | |
x: 24; y: 16 | |
// (3) bind height to 2 * width | |
height: 2 * width | |
// (4) custom property | |
property int times: 24 | |
// (5) property alias | |
property alias anotherTimes: thisLabel.times | |
// (6) set text appended by value | |
text: "Greetings " + times | |
// (7) font is a grouped property | |
font.family: "Ubuntu" | |
font.pixelSize: 24 | |
// (8) KeyNavigation is an attached property | |
KeyNavigation.tab: otherLabel | |
// (9) signal handler for property changes | |
onHeightChanged: console.log('height:', height) | |
// focus is need to receive key events | |
focus: true | |
// change color based on focus value | |
color: focus?"red":"black" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment