the application detects screen DPI scaling factor and scale up the user interface(main window and buttuns) and fonts.
The fonts are scaled always, but windows and buttons are scaled differently from fonts. For buttons and mainwindow used rounded fragmental scale factor - that is defenetly wrong.
I.e if Windows's screen dpi scalefactor is set to 125% => that is mean 1.25 system scale factor, it is treated as 1.25 for fonts and 1.0 for buttons due to rounding 1.25 to 1.0.
On the picture it is seen that it is hard to predict the size of the button that is needed to fit font scale on HiDPI display that would be chousen by user.
Even it we make button wide then the text it is not enough to make button text looks good.
So application created on normal machines looks and feel buggy and ugly on retina display with non round scales.
It is mentioned in -----
----- in late comments QTBUG-49195
mentioned in ----
---- saying that no fractional scalefactor supported, due to limitations of the styles, etc. QTBUG-55654
But actually fractional scalefactor does supported, due to
QTBUG-52196, my test and many comments i've seen.
I think font scale should be treated the same way as windows scale and be fractional on windows platform(i.e 1.25 both for fonts and buttons, not 1.25 for fonts and 1.00 for buttons).
It is to be tested with different styles, etc.., and it would be nice to avoid recompiling full Qt just for removing
qRound and replacing
This searching, replacement and recompiling took 2 days of my time and it can be hard for a novice Qt programmer to find and face with other qt linking bugs witch can be present in qt sources(there was errors in linking Qt 5.8.0 in my case).
So, I think, there must a environment variable, some thing like
Just to avoid recompilling Qt to get tested.Then in later releases, it is to be out date and deprecated
To reproduce a bug make a button with a text fit the buttons size. Add this code (i use MSVS 2013 so there is prinf. Replace is for what is what is suitable for you like qDebug
it prints out windows and buttons scale factor.
Then go to Conrol Panel -> Display -> move the slider right to one division (On Windows 8.1 this mean 125%), click Apply.
Restart the application. It will print out new scale factor. Or not new, the same 1, due to Round of 1.25
to test fractional scalefactor, compile and start the application and you will see fractional scalefactor, and what this time the text on the button fits button size.
comment qputenv("QT_SCREEN_SCALE_FACTORS", "1.25"); once again, go to
Omit qRound in QWindowsScreen::pixelDensity(), add dot zero to 96
so it to be
Recompile QT, replace qwindows.dll in a folder where you install qt. And you see the bug cleared.
PS1 the difference this bug report to the others mentioned reports, is not in un supporting fract factors, but in difference between font and windows scale factors
PS2. Actually i think the support of fractional scale factor might have present in Win Qt by default, without acting any special action exept setting QApplication::setAttribute(Qt::AA_EnableHighDpiScaling). So qRound in qwindowsscreen.cpp should be omitted and bugs in styles are to be found and fixed.
So it better to make buttons behave like fonts.
And i think it will be a bad idea to make fonts behave like buttons(e.i. be rounded too) and disabling fractional scalefactor at all. The second choice would be harder recovered from then the current state.