How to set font size for different screens
Unsolved
QML and Qt Quick
-
Hi Forum!
I have been looking around for a best practise in QML to set font sizes so that the app will look nice on different screens. My plan is to run the app on tablets and desktops.
What I learned so far is that I need to scale the fonts but all I read sounds more a hack than a solution. The best I found so far is this.
In a Qt tutorial if found that they were using Qt.application.font.pixelSize but I do not find any documentation on that.Currently I am using a js-file (Globals.js) where I defined some font sizes:
var fontSizeSmall = Qt.application.font.pixelSize*0.75 var fontSizeNormal = Qt.application.font.pixelSize var fontSizeBig = Qt.application.font.pixelSize*2
I include that file in my QML files and set the
font.pixelSize: Globals.fontSizeBig
Is this a good approach? Will this scale correctly on different platforms? What is the best practise to handle this?