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:

    1. Maximize
    2. Hide
    3. Change to a lower resolution in system preferences
    4. Change resolution back
    5. 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()->setGeometry(qApp->primaryScreen()->availableGeometry()); // This line is weird, see


    void MainWindow::maximizeWindow()

  • Lifetime Qt Champion

    Super with runable test project.
    I tried the same a few times.
    Flipflop resolution ( say yes to keep it)
    Then press the tray icon

    In 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.

  • Lifetime Qt Champion

    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.7

    But 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:


    main.cpp:6:32: error: 'AA_EnableHighDpiScaling' is not a member of 'Qt'
    main.cpp:7:32: error: 'AA_UseHighDpiPixmaps' is not a member of 'Qt'

  • 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?

  • Lifetime Qt Champion

    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 :)

  • @nestorac @mrjj
    Hello. Thank you for testing.

    @mrjj Did you enable DPI scaling? It should be 150% at least.
    Like here:
    DPI scaling

    @nestorac said in Maximized frameless window bug with enabled high dpi:

    @mrjj maybe he's opening the window on a secondary monitor?

    No, I have only one monitor.

  • Lifetime Qt Champion

    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.

  • Lifetime Qt Champion

    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 :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.