Quantcast
Channel: Active questions tagged qtquick2 - Stack Overflow
Viewing all articles
Browse latest Browse all 107

Autosizing the pixel size of text based on text length or size using fontSizeMode

$
0
0

I am trying to use fontSizeMode in order to fix a large text in a rectangle.

import QtQuick 2.9import QtQuick.Window 2.2Window{    visible: true    width: 640    height: 480    title: qsTr("Hello World")    Rectangle    {        color: "Red"        height:50        width:50        Text        {            text: "Hello"            fontSizeMode: Text.Fit            minimumPixelSize: 5            font.pixelSize: 50         }    }}

My aim is to shrink the text size if the text is bigger than the rectangle, and a minimum pixel size is given as shown in the program. But the text is not shrinking.

How can I solve this problem?


Viewing all articles
Browse latest Browse all 107

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>