EnableHighDpiScaling does not affect font pixelSize or pointSize
-
According to documentation 'Qt::AA_EnableHighDpiScaling' , introduced in Qt 5.6, enables automatic scaling based on the pixel density of the monitor.
Shall scale all sizes in screen. However it does not affect qml Text component's font.pixelSize or font.pointSize
How to scale text properly? What technics do I need to use to scale fonts? -
Try using Label component instead. And remember that flag only works with QtQuick.Controls 2.
-
Try using Label component instead. And remember that flag only works with QtQuick.Controls 2.
@sierdzio this flag works for all coordinates, not only for Controls 2 components.
Label behaves the same Way as Text.qreal refDpi = 216.; qreal refHeight = 1776.; qreal refWidth = 1080.; QRect rect = QGuiApplication::primaryScreen()->geometry(); qreal height = qMax(rect.width(), rect.height()); qreal width = qMin(rect.width(), rect.height()); qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch(); m_ratio = qMin(height/refHeight, width/refWidth); m_ratioFont = qMin(height*refDpi/(dpi*refHeight), width*refDpi/(dpi*refWidth));
formula from https://doc.qt.io/qt-5/scalability.html does not work for text scaling for me
Does anybody have solution which works for Android and iOs for text scaling at same time?