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

Anchoring the widgets for resizing with the form

Scheduled Pinned Locked Moved Unsolved General and Desktop
layoutresize
22 Posts 5 Posters 13.2k Views 3 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.
  • jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on 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
    • nulluseN Offline
      nulluseN Offline
      nulluse
      wrote on 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?

      mrjjM 1 Reply Last reply
      0
      • nulluseN nulluse

        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?

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on 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.

        nulluseN 1 Reply Last reply
        0
        • mrjjM mrjj

          @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.

          nulluseN Offline
          nulluseN Offline
          nulluse
          wrote on 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.

          mrjjM kshegunovK 2 Replies Last reply
          0
          • nulluseN nulluse

            @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.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on 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.

            nulluseN 1 Reply Last reply
            0
            • nulluseN nulluse

              @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.

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on 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
              • nulluseN Offline
                nulluseN Offline
                nulluse
                wrote on 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
                • mrjjM mrjj

                  @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.

                  nulluseN Offline
                  nulluseN Offline
                  nulluse
                  wrote on 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
                  • nulluseN Offline
                    nulluseN Offline
                    nulluse
                    wrote on 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
                    0
                    • nulluseN nulluse

                      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 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 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