Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Maximized frameless window bug with enabled high dpi
Forum Updated to NodeBB v4.3 + New Features

Maximized frameless window bug with enabled high dpi

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 3 Posters 4.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kosh543
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    1
    • nestoracN Offline
      nestoracN Offline
      nestorac
      wrote on last edited by
      #2

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

      1 Reply Last reply
      1
      • nestoracN Offline
        nestoracN Offline
        nestorac
        wrote on last edited by
        #3

        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();
        }
        
        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 icon

          In all cases, the "4" was still visible and it appears to have correct size.

          I am using Qt 5.7

          nestoracN 1 Reply Last reply
          1
          • mrjjM mrjj

            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 icon

            In all cases, the "4" was still visible and it appears to have correct size.

            I am using Qt 5.7

            nestoracN Offline
            nestoracN Offline
            nestorac
            wrote on last edited by
            #5

            @mrjj maybe he's opening the window on a secondary monitor? I'm relatively new to Qt, but still want to help.

            mrjjM 1 Reply Last reply
            1
            • nestoracN nestorac

              @mrjj maybe he's opening the window on a secondary monitor? I'm relatively new to Qt, but still want to help.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

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

              1 Reply Last reply
              0
              • nestoracN Offline
                nestoracN Offline
                nestorac
                wrote on last edited by
                #7

                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);
                
                1 Reply Last reply
                1
                • nestoracN Offline
                  nestoracN Offline
                  nestorac
                  wrote on last edited by
                  #8

                  The generated Makefile is for Qt4. Huh

                  1 Reply Last reply
                  1
                  • nestoracN Offline
                    nestoracN Offline
                    nestorac
                    wrote on last edited by
                    #9

                    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?

                    1 Reply Last reply
                    1
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

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

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kosh543
                        wrote on last edited by
                        #11

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

                        mrjjM 1 Reply Last reply
                        0
                        • K kosh543

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

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @kosh543
                          Hi
                          Tried with 150 % scale.
                          Still "4" is visible. Cannot reproduce with 5.7currently.

                          1 Reply Last reply
                          1
                          • K Offline
                            K Offline
                            kosh543
                            wrote on last edited by
                            #13

                            @mrjj
                            I tried Qt 5.7, and I cannot reproduce it here too.
                            Thank you very much!

                            1 Reply Last reply
                            1
                            • nestoracN Offline
                              nestoracN Offline
                              nestorac
                              wrote on last edited by
                              #14

                              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.

                              mrjjM 1 Reply Last reply
                              1
                              • nestoracN nestorac

                                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.

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

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

                                1 Reply Last reply
                                1

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved