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. Dialog doesn't fill up full space of window on Windows
Forum Updated to NodeBB v4.3 + New Features

Dialog doesn't fill up full space of window on Windows

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 1.7k Views 2 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.
  • E Offline
    E Offline
    efremdan1
    wrote on last edited by
    #1

    I designed a dialog using Qt Creator 4.14.0 (running Qt 5.15.2) on a macOS 10.15. The dialog consists of a bunch of widgets in a GridLayout and a ButtonBox, with a VerticalLayout applied to the entire dialog box. After applying these layouts, I dragged the bounding boxes for the dialog to be as small as Qt Creator allows me to make them (a height of 369).

    When I view this dialog on my Mac, it looks fine, similarly to how it looks on the Qt Creator form. However, when I compile and then view it on a Windows laptop, there's a lot of extra space at the time of the form; it looks just like what Tools->Form Editor->Preview In->Windows Style says it will look like, a screenshot of which is attached (the preview is in the foreground, with the Qt Creator form in the background). I need to re-size the dialog box manually to get it to look right.

    I believe the issue is that the dialog opens up to a height of 369 regardless of the platform, and the grid layout on Windows is tighter than it is on Mac, which leads to that empty space. Any tips for how I can make the dialog open up to the minimal height on each platform?

    ![0_1609808527039_Screen Shot 2021-01-04 at 7.36.33 PM.png](Uploading 100%)

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #6

      @efremdan1 said in Dialog doesn't fill up full space of window on Windows:

      However, there appears to be no way to not set the width and height in Designer.

      Put your cursor in the geometry value column of the properties panel. Click the "unset" icon that appears in the right hand end of the geometry edit box. On my Linux box this results in the dialog preview assuming a minimal size based on the size hints of the elements in the layout.

      Screenshot_20210107_105447.png

      E 1 Reply Last reply
      2
      • E Offline
        E Offline
        efremdan1
        wrote on last edited by
        #2

        Here's the screenshot that didn't upload before.

        Screen Shot 2021-01-04 at 7.36.33 PM.png

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #3

          Hi,

          You are setting a width and a hight in designer so these values will be used no matter the platform. AFAIK, if you do not set these, the widget will get its size from the hints given by its content.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • E Offline
            E Offline
            efremdan1
            wrote on last edited by
            #4

            Yes, Designer is indeed setting the width and height. If I overwrite the values given by Designer in my own script, e.g., if I say self.resize(1,1) after setting up the GUI, then things work.

            However, there appears to be no way to not set the width and height in Designer. Nor is there a way to set the width and height to values that go below the minimum values on the system I'm designing on (i.e., Designer on my Mac doesn't allow me to bring the height below 369 even that the height is less than that on Windows). I guess I can overwrite that resizing command for each dialog window I create, but that's a very unelegant solution...

            Any idea for how to fix this issue in Designer?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #5

              You can use the sizeHint method to get a value that should suitable.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • C Offline
                C Offline
                ChrisW67
                wrote on last edited by
                #6

                @efremdan1 said in Dialog doesn't fill up full space of window on Windows:

                However, there appears to be no way to not set the width and height in Designer.

                Put your cursor in the geometry value column of the properties panel. Click the "unset" icon that appears in the right hand end of the geometry edit box. On my Linux box this results in the dialog preview assuming a minimal size based on the size hints of the elements in the layout.

                Screenshot_20210107_105447.png

                E 1 Reply Last reply
                2
                • C ChrisW67

                  @efremdan1 said in Dialog doesn't fill up full space of window on Windows:

                  However, there appears to be no way to not set the width and height in Designer.

                  Put your cursor in the geometry value column of the properties panel. Click the "unset" icon that appears in the right hand end of the geometry edit box. On my Linux box this results in the dialog preview assuming a minimal size based on the size hints of the elements in the layout.

                  Screenshot_20210107_105447.png

                  E Offline
                  E Offline
                  efremdan1
                  wrote on last edited by
                  #7

                  @ChrisW67 said in Dialog doesn't fill up full space of window on Windows:

                  Put your cursor in the geometry value column of the properties panel. Click the "unset" icon that appears in the right hand end of the geometry edit box. On my Linux box this results in the dialog preview assuming a minimal size based on the size hints of the elements in the layout.

                  The "minimal size" it assumes is dependent on the system in which Qt Creator/Designer is running. On my Mac, clicking that unset icon results in the height going to 369, which is the minimal size on the Mac platform. However, the minimal size on Linux is smaller. So unless I design this dialog on Linux, I won't be able to get that minimal size to appear. Since I'm primarily designing this multi-platform application on my Mac, this doesn't really help.

                  C 1 Reply Last reply
                  0
                  • E efremdan1

                    @ChrisW67 said in Dialog doesn't fill up full space of window on Windows:

                    Put your cursor in the geometry value column of the properties panel. Click the "unset" icon that appears in the right hand end of the geometry edit box. On my Linux box this results in the dialog preview assuming a minimal size based on the size hints of the elements in the layout.

                    The "minimal size" it assumes is dependent on the system in which Qt Creator/Designer is running. On my Mac, clicking that unset icon results in the height going to 369, which is the minimal size on the Mac platform. However, the minimal size on Linux is smaller. So unless I design this dialog on Linux, I won't be able to get that minimal size to appear. Since I'm primarily designing this multi-platform application on my Mac, this doesn't really help.

                    C Offline
                    C Offline
                    ChrisW67
                    wrote on last edited by
                    #8

                    Using the reset arrow will remove the defined size for the widget from the UI file produced by Designer. When UIC processes this at compile time on the Windows platform it cannot be getting the magic 369 pixels from the UI file.

                    What happens if you apply the grid layout directly to the dialog form rather than nesting it inside a QVBoxLayout?

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      efremdan1
                      wrote on last edited by
                      #9

                      @ChrisW67 said in Dialog doesn't fill up full space of window on Windows:

                      Using the reset arrow will remove the defined size for the widget from the UI file produced by Designer. When UIC processes this at compile time on the Windows platform it cannot be getting the magic 369 pixels from the UI file.

                      You are correct. Sorry, I wasn't fully testing your answer. When I saw clicking the reset arrow made the size on Qt Creator 369, I assumed that saving the file would have 369 appear in the UI file in the same manner as if I set the size to 369 in Qt Creator myself. However, the reset arrow actually does remove that number from the UI file. So your solution works.

                      Thank you!

                      1 Reply Last reply
                      0

                      • Login

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