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

QT Creator incorrect layout

Scheduled Pinned Locked Moved Solved General and Desktop
qtcreator
16 Posts 5 Posters 1.4k Views
  • 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.
  • C Offline
    C Offline
    ChrisW67
    wrote on 12 Jun 2022, 11:37 last edited by
    #2

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

    J S 2 Replies Last reply 12 Jun 2022, 11:49
    0
    • C ChrisW67
      12 Jun 2022, 11:37

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

      J Offline
      J Offline
      Josef Lintz
      wrote on 12 Jun 2022, 11:49 last edited by Josef Lintz 6 Dec 2022, 11:49
      #3

      @ChrisW67 Thanks for the reply, what does that mean exactly? Can please you show me an example?

      M 1 Reply Last reply 12 Jun 2022, 11:50
      0
      • J Josef Lintz
        12 Jun 2022, 11:49

        @ChrisW67 Thanks for the reply, what does that mean exactly? Can please you show me an example?

        M Offline
        M Offline
        mpergand
        wrote on 12 Jun 2022, 11:50 last edited by
        #4

        @Josef-Lintz
        Add a vertical spacer:

        J 1 Reply Last reply 12 Jun 2022, 12:04
        0
        • M mpergand
          12 Jun 2022, 11:50

          @Josef-Lintz
          Add a vertical spacer:

          J Offline
          J Offline
          Josef Lintz
          wrote on 12 Jun 2022, 12:04 last edited by
          #5

          @mpergand Ok, it seems to have worked?

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

          But why? what exactly is happening here?

          M J 2 Replies Last reply 12 Jun 2022, 12:43
          0
          • J Josef Lintz
            12 Jun 2022, 12:04

            @mpergand Ok, it seems to have worked?

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

            But why? what exactly is happening here?

            M Offline
            M Offline
            mpergand
            wrote on 12 Jun 2022, 12:43 last edited by mpergand 6 Dec 2022, 12:45
            #6

            @Josef-Lintz
            If you don't put a spacer, all the widgets are equally spaced vertically.
            (assuming they are in a layout)

            1 Reply Last reply
            0
            • J Josef Lintz
              12 Jun 2022, 12:04

              @mpergand Ok, it seems to have worked?

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

              But why? what exactly is happening here?

              J Offline
              J Offline
              JonB
              wrote on 12 Jun 2022, 12:50 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 12 Jun 2022, 13:19 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 12 Jun 2022, 13:31
                0
                • J Josef Lintz
                  12 Jun 2022, 13:19

                  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 12 Jun 2022, 13:31 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 12 Jun 2022, 13:46
                  0
                  • M mpergand
                    12 Jun 2022, 13:31

                    @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 12 Jun 2022, 13:46 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 12 Jun 2022, 13:52
                    0
                    • J Josef Lintz
                      12 Jun 2022, 13:46

                      @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 12 Jun 2022, 13:52 last edited by
                      #11

                      @Josef-Lintz

                      J 1 Reply Last reply 12 Jun 2022, 14:00
                      1
                      • M mpergand
                        12 Jun 2022, 13:52

                        @Josef-Lintz

                        J Offline
                        J Offline
                        Josef Lintz
                        wrote on 12 Jun 2022, 14:00 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
                          12 Jun 2022, 11:37

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

                          S Offline
                          S Offline
                          SimonSchroeder
                          wrote on 13 Jun 2022, 09:11 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 13 Jun 2022, 10:17
                          0
                          • S SimonSchroeder
                            13 Jun 2022, 09:11

                            @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 13 Jun 2022, 10:17 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 13 Jun 2022, 10:28 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 13 Jun 2022, 10:58
                              0
                              • J Josef Lintz
                                13 Jun 2022, 10:28

                                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 13 Jun 2022, 10:58 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

                                11/16

                                12 Jun 2022, 13:52

                                • Login

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