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. [Solved] How to resize objects when the window is expanding?
QtWS25 Last Chance

[Solved] How to resize objects when the window is expanding?

Scheduled Pinned Locked Moved General and Desktop
16 Posts 3 Posters 3.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.
  • I Offline
    I Offline
    itsmemax
    wrote on last edited by
    #1

    Hi there. I currently need to let all widgets in my window automatically resize when I expand the window. I already tried to put everything into a QFormLayout and then the QFormLayout into a QWidget. But this does not show any differences. It's still not resizing.
    So, what do I have to do?

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

      Hi,

      Can you show how you setup your widgets/layout ?

      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
      • Q Offline
        Q Offline
        qxoz
        wrote on last edited by
        #3

        Try experiment with "sizePolicy":http://qt-project.org/doc/qt-5/qwidget.html#sizePolicy-prop

        1 Reply Last reply
        0
        • I Offline
          I Offline
          itsmemax
          wrote on last edited by
          #4

          !http://i.epvpimg.com/jGEob.png(picture)!
          That's my setup. I also tried to experiment with sizePolicy on different widgets and the window itself, without effect.

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            qxoz
            wrote on last edited by
            #5

            Your centralWidget has no layout.

            1 Reply Last reply
            0
            • I Offline
              I Offline
              itsmemax
              wrote on last edited by
              #6

              Set the centralwidget on a vertical layout now. So that was why there was a stop sign, got headache because of this lol. Now, that's my new setup (read a bit through the documentation etc., but yeah, still no effect):

              !http://i.epvpimg.com/yQ78g.png(picture)!

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

                Are you sure you need that many layouts ?

                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
                • Q Offline
                  Q Offline
                  qxoz
                  wrote on last edited by
                  #8

                  You do not need layout for every widget.
                  Show us screenshot of form editor and tell how do you want resize widgets on form resize.

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    qxoz
                    wrote on last edited by
                    #9

                    Also take a look to "Docs":http://qt-project.org/doc/qt-5/layout.html

                    1 Reply Last reply
                    0
                    • I Offline
                      I Offline
                      itsmemax
                      wrote on last edited by
                      #10

                      !http://i.epvpimg.com/fdqtf.png(picture)!

                      Well, the OK button should move to the right and the bottom. The textbox and the button next to it should resize horizontally. The two labels can stay where they are.
                      I really don't know why nothing happens when I resize the window.

                      1 Reply Last reply
                      0
                      • Q Offline
                        Q Offline
                        qxoz
                        wrote on last edited by
                        #11

                        Ok. What about -horizontal- vertical resizing?

                        edited

                        1 Reply Last reply
                        0
                        • I Offline
                          I Offline
                          itsmemax
                          wrote on last edited by
                          #12

                          Nah, just as I told. The OK buttom just moves bottom/right, the textfield/button in the middle resize horizontally and the stuff at the top should stay.

                          1 Reply Last reply
                          0
                          • Q Offline
                            Q Offline
                            qxoz
                            wrote on last edited by
                            #13

                            Sorry :). I mean Vertical resizing.

                            1 Reply Last reply
                            0
                            • I Offline
                              I Offline
                              itsmemax
                              wrote on last edited by
                              #14

                              No, only the bottom on the bottom right should move. No vertical resizing/moving. Only for the bottom right button.

                              1 Reply Last reply
                              0
                              • Q Offline
                                Q Offline
                                qxoz
                                wrote on last edited by
                                #15

                                Well then here the simple solution:
                                !http://s14.postimg.org/6u38iuaap/Untitled.png(layout)!

                                1 Reply Last reply
                                0
                                • I Offline
                                  I Offline
                                  itsmemax
                                  wrote on last edited by
                                  #16

                                  Oh my.. Thank you, it works! Had to create a whole new form though. Got a Qt book here for today, I'll read myself a bit into layout management. Thanks for your help!

                                  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