Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

How to make Text font size to be auto adjusted

$
0
0
How to make Text font size to be adjusted depending on parent width & height? Here is code snippet: Item {  width: 200 // that value will vary  height: 100 // that value will vary    Text {   id: label   anchors.top: parent.top; anchors.left: parent.left   font.pointSize: 10 // this can be static size   text: "current"  }    Text {   id: data   anchors.top: label.bottom; anchors.bottom: parent.bottom; anchors.left: parent.left;   anchors.topMargin: 5   font.pointSize: 40 // this should resize to fit parent size   text: "100"  }    Text {   id: units   anchors.bottom: data.bottom; anchors.left: data.right   anchors.leftMargin: 5   font.pointSize: data.font.pointSize/2 // this will be resized aswell   text: "mA"  } }

Viewing all articles
Browse latest Browse all 4972

Latest Images

Trending Articles



Latest Images