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 can I resize child widgets after applying a layout on a parent widget ??

<Solved>How can I resize child widgets after applying a layout on a parent widget ??

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 4.0k Views 1 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.
  • A Offline
    A Offline
    ankursaxena
    wrote on last edited by
    #1

    Hi all,

    I am facing a problem when i apply layouts in a widget. then size of child widgets are changed automatically. but now, I want to resize it again as same size as earlier to applying layout. but it is not allowing to do so.

    So, please tell me how can i resize child widgets after applying layout?

    Thanx in Advance.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @
      widget.setLayout(something);
      widget.resize(widget.sizeHint());
      @

      (Z(:^

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ankursaxena
        wrote on last edited by
        #3

        Hi sierdzio,

        thank u for the help. but i want to do it in designer mode. once i set layout on widget in qt designer. then child widgets are locked. Therefore, i am unable to resize them. Is there any way to resize these child widgets ??

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          You need to resize the whole window, then. Child sizes are managed by the layout.

          You can experiment with size policy settings (change to Preffered, Minimal, Expanding, etc.).

          (Z(:^

          1 Reply Last reply
          0
          • A Offline
            A Offline
            ankursaxena
            wrote on last edited by
            #5

            Hi sierdzio, I have experimented with size policy settings. Yes, It applied some changes in my ui. but that is not as per my requirement since those changes are bound also.

            Any way, thanx for the suggestion . if there is any other way to perform this. then please share with me. Thank you.

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              You can also set the minimum- and maximumSize properties to force the layout to use certain sizes. But the whole point of layouts in widgets is not to care about subwidget sizes: that is the job for the layout.

              (Z(:^

              1 Reply Last reply
              0
              • A Offline
                A Offline
                ankursaxena
                wrote on last edited by
                #7

                Okah. means when we applied any layout then we don't have full control over widget's size properties. hence it is the job of layout . Am i right ??

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #8

                  Correct. Layouts are there to save you the hassle of manually setting x, y, width and height coordinates. They will fill the available space according to the rules of a particular layout (horizontal layout, grid, vertical, etc.).

                  (Z(:^

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    ankursaxena
                    wrote on last edited by
                    #9

                    Okah. Thank you. sierdzio.

                    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