I have a problem making sense of the values I get from QFontMetrics
// 43 characters 0123456789012345678901234567890123456789012
static const QString s("The quick brown fox jumps over the lazy dog");
// Hint: basically returns w->fontMetrics(); with w being my main application window
const QFontMetrics fm = CGuiUtility::currentFontMetrics();
const int w = fm.width(s);
const int h = fm.height();
return QSize(w, h);
With the following screen resolutions I get:
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1")
My understanding is that I do get pixel width/height. I wonder why I get a so much smaller height with a hires resolution (see 2). I would rather expect it the other way around - using more pixels.
What I can see is that there is (almost) factor 2 between 1 and 3, which makes sense. But then (using 3, no DPI support) the UI is unreadable (too small because of hi DPI screen). So how does 2 fit in, which has some odd results.
Is anybody able to give a hint on the interpretation of those values?
Remark: Related to Style sheets / Qt Designer support for high dpi screens? What I try to find is a reasonable width/height for my UI window on different resolutions/platforms
Good comments, I see. With hi-dpi Qt scales 1:3 using a "virtual screen" of 1280/780. I wonder if I can adjust that pixel ratio manually. In my very case it happens by setting qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1")
. Is there a chance to set it to 2:1?
Based on the hints of AlexanderVX and SteackOverflow it is clear now.
Therefor I close the topiy