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. Can't change size of widgets inside layouts in QDesigner
Forum Updated to NodeBB v4.3 + New Features

Can't change size of widgets inside layouts in QDesigner

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 4.2k Views 2 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.
  • Please_Help_me_DP Offline
    Please_Help_me_DP Offline
    Please_Help_me_D
    wrote on last edited by
    #1

    Hi,

    I have created two tab-widgets and inside the left one I created three QTreeWidgets.
    I created layouts with vertical splitter to split tab-widgets and layout with horizontal splitters to split QTreeWidgets.
    Now I need to set size for tab-widgets: left tab should have width lesser than width of right tab.
    As you can see on the pictures I can't manipulate with their size and moreover when I launch the app the size dramatically changes :)
    How to set width of left tab as small as possible to the full text in QTreeWidgets and width of right side as big as possible?
    design.png app.png

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      Their dimensions are governed by sizePolicy and minimumSize and maximumSize attributes.

      I light my way forward with the fires of all the bridges I've burned behind me.

      Please_Help_me_DP 1 Reply Last reply
      4
      • Kent-DorfmanK Kent-Dorfman

        Their dimensions are governed by sizePolicy and minimumSize and maximumSize attributes.

        Please_Help_me_DP Offline
        Please_Help_me_DP Offline
        Please_Help_me_D
        wrote on last edited by
        #3

        @Kent-Dorfman Thank you!
        That helped. I changed numbers in size-policy (horizontal stretch) and I got something that I wanted even I still dont understand the affect of these numbers on the size of widgets. I.e I can set horizontal stretch equal to 1 or equal to 255 and the effect would be the same

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

          Hi,

          For the stretch value, if you have two widgets in a horizontal layout and both have a stretch of same value they will both take the same amount of space in the layout. If you put one stretch value at 1 and the other at 2, then the second widget will take more space than the first one based on the values used.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Please_Help_me_DP 1 Reply Last reply
          3
          • SGaistS SGaist

            Hi,

            For the stretch value, if you have two widgets in a horizontal layout and both have a stretch of same value they will both take the same amount of space in the layout. If you put one stretch value at 1 and the other at 2, then the second widget will take more space than the first one based on the values used.

            Please_Help_me_DP Offline
            Please_Help_me_DP Offline
            Please_Help_me_D
            wrote on last edited by
            #5

            @SGaist thank you but still I have two widgets in horizontal layout. Both of them have Expanding size Policy. Here are some values of stretch and the result:

            • left widget stretch = 0, right widget stretch = 100 => right takes more space
            • left widget stretch = 1, right widget stretch = 100 => left takes more space
            • left widget stretch = 200, right widget stretch = 100 => left takes more space

            Actually the result from points 2 and 3 are equal i.e. there are only two positions of widgets for any variants of stretch. I'm talking about two widgets that are present in the picture above (tab widgets and left one includes three qtreewidgets)

            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