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. QMdiSubWindow incorrect size - some hint needed

QMdiSubWindow incorrect size - some hint needed

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 575 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.
  • MasterBLBM Offline
    MasterBLBM Offline
    MasterBLB
    wrote on last edited by
    #1

    Hello mates

    I'm looking for a hint why instance of QMdiSubWindow, created by use of QMdiArea->addSubWindow(myWidget) has incorrect, too large height, as you can see on the picture:
    SizeHint mismatch.PNG
    left widget has set correct height set manually by resizing subwindow, right one is what its sizeHint() return.
    I also did a test of just displaying the myWidget, without putting it into QMdiSubwindow - the size was fine.

    What should I investigate deeper into?

    Qt 5.15.2 MinGW 64-bit

    C 1 Reply Last reply
    0
    • C ChrisW67

      @MasterBLB That's a lot to stuff into one UI file. I do not see anything overtly broken layout-wise in the UI file. However, the panels that are being truncated are not present in the file, just a placeholder QWidget that I assume you stuff a layout and widgets into programmatically.

      Seems to me that left/right arm, left/right leg, left/centre/right torso elements are good candidates for QListWidget or QTableWidget (maybe with custom delegate). Alternatively, each placeholder widget could be placed inside a QScrollArea. On a similar note, QFormLayout might be useful in a few places.

      This is my best guess at the variable size thing:

      When you place a widget into QMdiSubWindow it will size itself on the basis of the size hint provided by the widget. This hint will, in general, be the aggregate of all subordinate widget and layout size hints, i.e. enough to display everything. This may include space for the Tags and Description group box that is not presently displayed in the screen shot.

      When you display this widget in isolation it will size itself according to the geometry you have explicitly set in the UI design (1224x652)..

      MasterBLBM Offline
      MasterBLBM Offline
      MasterBLB
      wrote on last edited by MasterBLB
      #5

      I managed to find the reason. It was because verticalSpacer (the one which consumes space below Alphas To Overheat label) had set height to 40; when I put 0 there the window now is displayed in correct size.
      Funny thing though, I recall I had to set that height because of some reasons, but don't remember what exactly.

      @ChrisW67 Thanks for hints mate, and trying to help.

      1 Reply Last reply
      0
      • MasterBLBM MasterBLB

        Hello mates

        I'm looking for a hint why instance of QMdiSubWindow, created by use of QMdiArea->addSubWindow(myWidget) has incorrect, too large height, as you can see on the picture:
        SizeHint mismatch.PNG
        left widget has set correct height set manually by resizing subwindow, right one is what its sizeHint() return.
        I also did a test of just displaying the myWidget, without putting it into QMdiSubwindow - the size was fine.

        What should I investigate deeper into?

        Qt 5.15.2 MinGW 64-bit

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

        @MasterBLB They are different sizes because the one on the left is showing less. For example see the corresponding highlighted areas in the your image.
        195725da-446f-4004-8fea-bdc39f6df965.PNG

        This tells me that the content is not in a layout being managed by a Qt class. If it is meant to be in a layout then something is broken there, (possibly a break in the layout tree). If you are managing layout yourself then the logic needs attention I suspect.

        MasterBLBM 1 Reply Last reply
        2
        • C ChrisW67

          @MasterBLB They are different sizes because the one on the left is showing less. For example see the corresponding highlighted areas in the your image.
          195725da-446f-4004-8fea-bdc39f6df965.PNG

          This tells me that the content is not in a layout being managed by a Qt class. If it is meant to be in a layout then something is broken there, (possibly a break in the layout tree). If you are managing layout yourself then the logic needs attention I suspect.

          MasterBLBM Offline
          MasterBLBM Offline
          MasterBLB
          wrote on last edited by MasterBLB
          #3

          @ChrisW67 You're right, the manually shrunk subwindow deducted some height from widgets Left/Right arm and torso indeed. Still, this is weird, as program compiled on Windows7, and using Qt 5.11.x (don't remember exactly the version) has the size correct:

          C 1 Reply Last reply
          0
          • MasterBLBM MasterBLB

            @ChrisW67 You're right, the manually shrunk subwindow deducted some height from widgets Left/Right arm and torso indeed. Still, this is weird, as program compiled on Windows7, and using Qt 5.11.x (don't remember exactly the version) has the size correct:

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

            @MasterBLB That's a lot to stuff into one UI file. I do not see anything overtly broken layout-wise in the UI file. However, the panels that are being truncated are not present in the file, just a placeholder QWidget that I assume you stuff a layout and widgets into programmatically.

            Seems to me that left/right arm, left/right leg, left/centre/right torso elements are good candidates for QListWidget or QTableWidget (maybe with custom delegate). Alternatively, each placeholder widget could be placed inside a QScrollArea. On a similar note, QFormLayout might be useful in a few places.

            This is my best guess at the variable size thing:

            When you place a widget into QMdiSubWindow it will size itself on the basis of the size hint provided by the widget. This hint will, in general, be the aggregate of all subordinate widget and layout size hints, i.e. enough to display everything. This may include space for the Tags and Description group box that is not presently displayed in the screen shot.

            When you display this widget in isolation it will size itself according to the geometry you have explicitly set in the UI design (1224x652)..

            MasterBLBM 1 Reply Last reply
            0
            • C ChrisW67

              @MasterBLB That's a lot to stuff into one UI file. I do not see anything overtly broken layout-wise in the UI file. However, the panels that are being truncated are not present in the file, just a placeholder QWidget that I assume you stuff a layout and widgets into programmatically.

              Seems to me that left/right arm, left/right leg, left/centre/right torso elements are good candidates for QListWidget or QTableWidget (maybe with custom delegate). Alternatively, each placeholder widget could be placed inside a QScrollArea. On a similar note, QFormLayout might be useful in a few places.

              This is my best guess at the variable size thing:

              When you place a widget into QMdiSubWindow it will size itself on the basis of the size hint provided by the widget. This hint will, in general, be the aggregate of all subordinate widget and layout size hints, i.e. enough to display everything. This may include space for the Tags and Description group box that is not presently displayed in the screen shot.

              When you display this widget in isolation it will size itself according to the geometry you have explicitly set in the UI design (1224x652)..

              MasterBLBM Offline
              MasterBLBM Offline
              MasterBLB
              wrote on last edited by MasterBLB
              #5

              I managed to find the reason. It was because verticalSpacer (the one which consumes space below Alphas To Overheat label) had set height to 40; when I put 0 there the window now is displayed in correct size.
              Funny thing though, I recall I had to set that height because of some reasons, but don't remember what exactly.

              @ChrisW67 Thanks for hints mate, and trying to help.

              1 Reply Last reply
              0
              • MasterBLBM MasterBLB has marked this topic as solved on

              • Login

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