Skip to content

Instantly share code, notes, and snippets.

@FONQRI
Created March 16, 2023 04:59
Show Gist options
  • Save FONQRI/4a66509ce278c29939b2f9c1a9091cd8 to your computer and use it in GitHub Desktop.
Save FONQRI/4a66509ce278c29939b2f9c1a9091cd8 to your computer and use it in GitHub Desktop.
Qt quick tutorial property text for moderncpp.ir
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