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. QT Creator incorrect layout
Forum Updated to NodeBB v4.3 + New Features

QT Creator incorrect layout

Scheduled Pinned Locked Moved Solved General and Desktop
qtcreator
16 Posts 5 Posters 1.4k 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.
  • J Josef Lintz

    @mpergand Ok, it seems to have worked?

    3103dd9c-15cf-43b1-9fa1-ce60a9a6b502-image.png

    But why? what exactly is happening here?

    JonBJ Online
    JonBJ Online
    JonB
    wrote on last edited by
    #7

    @Josef-Lintz
    Also are you aware/did you intend that from the screenshot having not one but two red boxes you have more than just one vertical layout going on here, hence your "irregular" spacing. Don't do that if you want all 3 line edits treated the same.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Josef Lintz
      wrote on last edited by
      #8

      I'm not sure if that's the problem, that is intentional.
      I want there to be a gap between the first line edit(top), and the other two(bottom).
      So I put the two lower line edits into separate vertical layouts and added a margin to the top line edit.
      But now that I think about it, maybe I could've just used a single vertical layout and set the margin only for the top line edit.

      M 1 Reply Last reply
      0
      • J Josef Lintz

        I'm not sure if that's the problem, that is intentional.
        I want there to be a gap between the first line edit(top), and the other two(bottom).
        So I put the two lower line edits into separate vertical layouts and added a margin to the top line edit.
        But now that I think about it, maybe I could've just used a single vertical layout and set the margin only for the top line edit.

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

        @Josef-Lintz said in QT Creator incorrect layout:

        I want there to be a gap between the first line edit(top), and the other two(bottom).

        You can add a spacer with a fixed height.

        J 1 Reply Last reply
        0
        • M mpergand

          @Josef-Lintz said in QT Creator incorrect layout:

          I want there to be a gap between the first line edit(top), and the other two(bottom).

          You can add a spacer with a fixed height.

          J Offline
          J Offline
          Josef Lintz
          wrote on last edited by
          #10

          @mpergand So in a sense, use two vertical spacers one between the top line edit and the two other line edits, and another one between the two bottom line edits, and the buttons at the bottom?

          M 1 Reply Last reply
          0
          • J Josef Lintz

            @mpergand So in a sense, use two vertical spacers one between the top line edit and the two other line edits, and another one between the two bottom line edits, and the buttons at the bottom?

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

            @Josef-Lintz

            J 1 Reply Last reply
            1
            • M mpergand

              @Josef-Lintz

              J Offline
              J Offline
              Josef Lintz
              wrote on last edited by
              #12

              @mpergand Yeah, that's exactly what I meant. I'll do that tomorrow when I'm back at work

              1 Reply Last reply
              0
              • C ChrisW67

                Looks like you have not applied a layout to the containing widget.

                S Offline
                S Offline
                SimonSchroeder
                wrote on last edited by
                #13

                @ChrisW67 said in QT Creator incorrect layout:

                Looks like you have not applied a layout to the containing widget.

                You should still have a look into this. Currently, you could just use absolute positions of your widgets. The layout does not do very much. Try resizing your dialog box and you'll see that everything is at a fixed position. Instead you should have a layout for the widget itself so that the size of the dialog and its contents match each other (very important if people have, e.g., 4K displays with a scaling ratio).

                To do this: right-click on the widget and apply a layout (or use the corresponding button in the toolbar).

                J 1 Reply Last reply
                0
                • S SimonSchroeder

                  @ChrisW67 said in QT Creator incorrect layout:

                  Looks like you have not applied a layout to the containing widget.

                  You should still have a look into this. Currently, you could just use absolute positions of your widgets. The layout does not do very much. Try resizing your dialog box and you'll see that everything is at a fixed position. Instead you should have a layout for the widget itself so that the size of the dialog and its contents match each other (very important if people have, e.g., 4K displays with a scaling ratio).

                  To do this: right-click on the widget and apply a layout (or use the corresponding button in the toolbar).

                  J Offline
                  J Offline
                  Josef Lintz
                  wrote on last edited by
                  #14

                  @SimonSchroeder Thank you so much.
                  This was exactly what I wanted to ask next, but I was so caught up at work

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    Josef Lintz
                    wrote on last edited by
                    #15

                    Also, one last question. Is there a way to disable resizing?
                    Most of the answers I found were related to C++ such as QWidget::setFixedSize(size()); etc...
                    Is there a way to do this from the designer?
                    Disabling sizeGripEnabled doesn't do anything, so I set the min and max size to the same number, but this feel hacky..

                    M 1 Reply Last reply
                    0
                    • J Josef Lintz

                      Also, one last question. Is there a way to disable resizing?
                      Most of the answers I found were related to C++ such as QWidget::setFixedSize(size()); etc...
                      Is there a way to do this from the designer?
                      Disabling sizeGripEnabled doesn't do anything, so I set the min and max size to the same number, but this feel hacky..

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

                      @Josef-Lintz said in QT Creator incorrect layout:

                      so I set the min and max size to the same number, but this feel hacky..

                      That's the thing to do.
                      Or by code with QWidget::setFixedSize(size()

                      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