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. Anchoring the widgets for resizing with the form

Anchoring the widgets for resizing with the form

Scheduled Pinned Locked Moved Unsolved General and Desktop
layoutresize
22 Posts 5 Posters 12.9k 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.
  • J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 9 May 2016, 05:09 last edited by
    #12

    "niche concept"?
    Are you sure layouts are a niche concept?
    As far as I know Java GUI for example uses layouts as well (see https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html). I like layouts - they are very flexible and powerful.

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    1
    • N Offline
      N Offline
      nulluse
      wrote on 9 May 2016, 13:44 last edited by
      #13

      Adding a layout to the UI elements on a form resizes and rearranges them all and it is not possible to change their sizes once they are in a layout. How's that powerful and flexible?

      M 1 Reply Last reply 9 May 2016, 13:50
      0
      • N nulluse
        9 May 2016, 13:44

        Adding a layout to the UI elements on a form resizes and rearranges them all and it is not possible to change their sizes once they are in a layout. How's that powerful and flexible?

        M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 9 May 2016, 13:50 last edited by
        #14

        @nulluse
        The layout define the size.Not reversed.
        If you dont want the layout size for all widgets ,
        u can then adjust with min/max sizes on individual widgets.
        You can also instruct layout if u want to be greedy and use all space/and or other options.

        N 1 Reply Last reply 9 May 2016, 14:30
        0
        • M mrjj
          9 May 2016, 13:50

          @nulluse
          The layout define the size.Not reversed.
          If you dont want the layout size for all widgets ,
          u can then adjust with min/max sizes on individual widgets.
          You can also instruct layout if u want to be greedy and use all space/and or other options.

          N Offline
          N Offline
          nulluse
          wrote on 9 May 2016, 14:30 last edited by
          #15

          @mrjj said:

          @nulluse
          If you dont want the layout size for all widgets ,
          u can then adjust with min/max sizes on individual widgets.
          You can also instruct layout if u want to be greedy and use all space/and or other options.

          Exactly! This is double work, and very tedious one, versus defining the anchors.
          The anchors do not require defining fixed sizes.

          M K 2 Replies Last reply 9 May 2016, 14:37
          0
          • N nulluse
            9 May 2016, 14:30

            @mrjj said:

            @nulluse
            If you dont want the layout size for all widgets ,
            u can then adjust with min/max sizes on individual widgets.
            You can also instruct layout if u want to be greedy and use all space/and or other options.

            Exactly! This is double work, and very tedious one, versus defining the anchors.
            The anchors do not require defining fixed sizes.

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 9 May 2016, 14:37 last edited by
            #16

            @nulluse
            Yeah but layouts dont either.
            Its assumed u want same size for all.
            So only if u dont , u set it.
            Its not double work as often NOT needed.
            I want same size for all anyway.
            and u can have margins if u want and many other nice tweaks.

            N 1 Reply Last reply 9 May 2016, 16:27
            0
            • N nulluse
              9 May 2016, 14:30

              @mrjj said:

              @nulluse
              If you dont want the layout size for all widgets ,
              u can then adjust with min/max sizes on individual widgets.
              You can also instruct layout if u want to be greedy and use all space/and or other options.

              Exactly! This is double work, and very tedious one, versus defining the anchors.
              The anchors do not require defining fixed sizes.

              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 9 May 2016, 16:12 last edited by
              #17

              @nulluse said:

              Exactly! This is double work, and very tedious one, versus defining the anchors.
              The anchors do not require defining fixed sizes.

              Neither do layouts. There are things called resize policies and stretch factors, which I suppose you should take a look at. Also how do you anchor two elements back to back such that one of them takes 2/3 of the space and one 1/3, ain't it necessary to go and set that manually?

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • N Offline
                N Offline
                nulluse
                wrote on 9 May 2016, 16:26 last edited by
                #18

                And that's even more work vs flipping yes/no anchors and not having to worry about anything else.

                1 Reply Last reply
                0
                • M mrjj
                  9 May 2016, 14:37

                  @nulluse
                  Yeah but layouts dont either.
                  Its assumed u want same size for all.
                  So only if u dont , u set it.
                  Its not double work as often NOT needed.
                  I want same size for all anyway.
                  and u can have margins if u want and many other nice tweaks.

                  N Offline
                  N Offline
                  nulluse
                  wrote on 9 May 2016, 16:27 last edited by
                  #19

                  @mrjj said:

                  @nulluse
                  Yeah but layouts dont either.
                  Its assumed u want same size for all.
                  So only if u dont , u set it.
                  Its not double work as often NOT needed.
                  I want same size for all anyway.
                  and u can have margins if u want and many other nice tweaks.

                  You probably need to look at a system that uses anchors to realize how much more productive they allow the developers to be.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    nulluse
                    wrote on 21 May 2016, 19:06 last edited by
                    #20

                    If the layouts are so wonderful, can anyone explain why specifying a horizontal layout for a form with 3 panels adds 9 pixel margin on all sides of the form? How can that margin be eliminated?

                    ? 1 Reply Last reply 21 May 2016, 19:25
                    0
                    • N nulluse
                      21 May 2016, 19:06

                      If the layouts are so wonderful, can anyone explain why specifying a horizontal layout for a form with 3 panels adds 9 pixel margin on all sides of the form? How can that margin be eliminated?

                      ? Offline
                      ? Offline
                      A Former User
                      wrote on 21 May 2016, 19:25 last edited by
                      #21

                      @nulluse said:

                      How can that margin be eliminated?

                      Simple: For centralWidget set layoutLeftMargin, layoutRightMargin, layoutTopMargin, layoutBottomMargin, and layoutSpacing all to 0. Default is 9, resp. 6.

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on 21 May 2016, 19:27 last edited by
                        #22

                        BTW: If you want a fancy GUI that doesn't look / behave natively then you can use QtQuick for that. Besides layouts it has anchors, too.

                        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