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. Qt5 too big space between widgets in one vertical layout.
Forum Updated to NodeBB v4.3 + New Features

Qt5 too big space between widgets in one vertical layout.

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 1.8k 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.
  • GUYUEZUNZHEG Offline
    GUYUEZUNZHEG Offline
    GUYUEZUNZHE
    wrote on last edited by
    #5

    Thank you for your reply! there are many widgets, I add a new widget by clicking the "Add" button. I tried putting a stretch before layer #1, it doesn't force them closer together. I will try put stretch after layer #2 and report it later.

    JonBJ 1 Reply Last reply
    0
    • GUYUEZUNZHEG GUYUEZUNZHE

      Thank you for your reply! there are many widgets, I add a new widget by clicking the "Add" button. I tried putting a stretch before layer #1, it doesn't force them closer together. I will try put stretch after layer #2 and report it later.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #6

      @GUYUEZUNZHE
      Certianly if you have stretches both above & below the two layers" will be pushed together as close as possible. If there is still a gap, then whatever your "layers" are, maybe they have, say, vertical margins or similar keeping them apart? Also make sure your vertical layout has 0 value for its QBoxLayout::setSpacing().

      1 Reply Last reply
      0
      • GUYUEZUNZHEG Offline
        GUYUEZUNZHEG Offline
        GUYUEZUNZHE
        wrote on last edited by
        #7

        @JonB said in Qt5 too big space between widgets in one vertical layout.:

        If there is still a gap, then whatever your "layers" are, maybe they have, say, vertical margins or similar keeping them apart?

        unfortunately! There is still a gap. there are no margins or similarities keeping them apart. here is the layer I edit.
        2788869d-bcbe-4219-ba1e-6a2edfbf2827-image.png

        JonBJ 1 Reply Last reply
        0
        • GUYUEZUNZHEG GUYUEZUNZHE

          @JonB said in Qt5 too big space between widgets in one vertical layout.:

          If there is still a gap, then whatever your "layers" are, maybe they have, say, vertical margins or similar keeping them apart?

          unfortunately! There is still a gap. there are no margins or similarities keeping them apart. here is the layer I edit.
          2788869d-bcbe-4219-ba1e-6a2edfbf2827-image.png

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #8

          @GUYUEZUNZHE
          Well I can see margins or similar all around the Layer #1 you show. But perhaps you mean there is a gap below the bottom of this Layer #1 and the top of the Layer #2, since in your earlier picture you show that in a different colour? Perhaps you should show a screenshot of what you actually see when you run the application so we can see what you are really talking about?

          GUYUEZUNZHEG 1 Reply Last reply
          0
          • JonBJ JonB

            @GUYUEZUNZHE
            Well I can see margins or similar all around the Layer #1 you show. But perhaps you mean there is a gap below the bottom of this Layer #1 and the top of the Layer #2, since in your earlier picture you show that in a different colour? Perhaps you should show a screenshot of what you actually see when you run the application so we can see what you are really talking about?

            GUYUEZUNZHEG Offline
            GUYUEZUNZHEG Offline
            GUYUEZUNZHE
            wrote on last edited by
            #9

            @JonB Yes, you are right! I mean there is a gap below the bottom of this Layer #1 and the top of Layer #2. I will take the screenshot soon. Thanks!

            JonBJ 1 Reply Last reply
            0
            • GUYUEZUNZHEG GUYUEZUNZHE

              @JonB Yes, you are right! I mean there is a gap below the bottom of this Layer #1 and the top of Layer #2. I will take the screenshot soon. Thanks!

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #10

              @GUYUEZUNZHE
              Are you sure you acted on the setSpacing() I mentioned? What does qDebug() << verticalLayout->spacing() report?

              GUYUEZUNZHEG 2 Replies Last reply
              0
              • GUYUEZUNZHEG Offline
                GUYUEZUNZHEG Offline
                GUYUEZUNZHE
                wrote on last edited by
                #11

                ui->verticalLayout_6->spacing() is 6

                1 Reply Last reply
                0
                • JonBJ JonB

                  @GUYUEZUNZHE
                  Are you sure you acted on the setSpacing() I mentioned? What does qDebug() << verticalLayout->spacing() report?

                  GUYUEZUNZHEG Offline
                  GUYUEZUNZHEG Offline
                  GUYUEZUNZHE
                  wrote on last edited by
                  #12

                  @JonB c630f872-1e13-44bf-a4e0-fb4247a3eddb-EC1213C1-EA7F-4db8-997B-7AE8C54EC6D7.png

                  M 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @GUYUEZUNZHE
                    Are you sure you acted on the setSpacing() I mentioned? What does qDebug() << verticalLayout->spacing() report?

                    GUYUEZUNZHEG Offline
                    GUYUEZUNZHEG Offline
                    GUYUEZUNZHE
                    wrote on last edited by
                    #13

                    @JonB but when I set spacing 0, there is still a big gap.

                    1 Reply Last reply
                    0
                    • GUYUEZUNZHEG GUYUEZUNZHE

                      @JonB c630f872-1e13-44bf-a4e0-fb4247a3eddb-EC1213C1-EA7F-4db8-997B-7AE8C54EC6D7.png

                      M Offline
                      M Offline
                      mpergand
                      wrote on last edited by
                      #14

                      @GUYUEZUNZHE
                      Try to add a VerticalSpacer at the end in verticalLayout.

                      GUYUEZUNZHEG 1 Reply Last reply
                      0
                      • M mpergand

                        @GUYUEZUNZHE
                        Try to add a VerticalSpacer at the end in verticalLayout.

                        GUYUEZUNZHEG Offline
                        GUYUEZUNZHEG Offline
                        GUYUEZUNZHE
                        wrote on last edited by
                        #15

                        @mpergand Thank you for your reply! I tried, It doesn't work! maybe The sub widget can't work well for Qt

                        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