Solved Maximized frameless window bug with enabled high dpi
-
Hi,
I use Qt 5.6 on Windows 10.
I have a problem with frameless window with enabled high dpi.
Simple project to reproduce the problem:
test project
Way to reproduce:- Maximize
- Hide
- Change to a lower resolution in system preferences
- Change resolution back
- Click on tray icon
After these steps, the window takes up much more space than is available on the screen.
How can I prevent this? -
It's strange, since when opening minimized windows it should give the right resolution. Plus, Windows is usually not capable of showing windows bigger than desktop resolution. Maybe you can file this as a bug, with proper information (more than here).
-
I would replace
void MainWindow::maximizeWindow() { window()->setWindowState(Qt::WindowMaximized); window()->setGeometry(qApp->primaryScreen()->availableGeometry()); // This line is weird, see http://doc.qt.io/qt-5/application-windows.html#window-geometry }
with
void MainWindow::maximizeWindow() { window()->showMaximized(); }
-
Hi
Super with runable test project.
I tried the same a few times.
Maximize
Hide
Flipflop resolution ( say yes to keep it)
Then press the tray iconIn all cases, the "4" was still visible and it appears to have correct size.
I am using Qt 5.7
-
@mrjj maybe he's opening the window on a secondary monitor? I'm relatively new to Qt, but still want to help.
-
@nestorac
Welcome on board then :)
Yes something must be different if he sees the bug and i cant get it.
Also he has Qt5.6 and i have Qt5.7But it sounds like he click on tray icon and as far as i know, this restore the
window to whatever screen it is/was on.Did u try test project, its just works so very easy to test.
( you can download as zip if do not use GIT) -
I get:
make
main.cpp:6:32: error: 'AA_EnableHighDpiScaling' is not a member of 'Qt' QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); ^ main.cpp:7:32: error: 'AA_UseHighDpiPixmaps' is not a member of 'Qt' QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
-
The generated Makefile is for Qt4. Huh
-
Sorry, sir, I got it working. Qt 5.6.2 on GNU/Linux Gentoo. Flawless. It all went fine, no error, at least on this platform, I don't use Windows. I have reproduced all the steps. Maybe a Windows error?
-
Super
thank you for testing also.
I will see if I can get a 5.6 on win 10 to test with.
Not sure its a bug yet :) -
-
@kosh543
Hi
Tried with 150 % scale.
Still "4" is visible. Cannot reproduce with 5.7currently. -
@mrjj
I tried Qt 5.7, and I cannot reproduce it here too.
Thank you very much! -
I cannot reproduce it with Linux since it is necessary to log in and out to try, to change the DPI, so it should always work. Maybe this is the problem? That you need to log out and in? Or it might be a bug of Qt not recognizing the cnange in DPI.
-
@nestorac
Hi, thx for testing on linux also.
Seems to be bug in 5.6 on win. Fixed in 5.7.
This is just guessing as didnt find the actual bug report :)