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. Resize Window
QtWS25 Last Chance

Resize Window

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.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.
  • A Offline
    A Offline
    AgmMetalDev
    wrote on last edited by
    #1

    Hi,

    how can I resize a widget with a QVBoxLayout containing different widgets keeping the proportions of each widget within the layout?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      Qnoobish
      wrote on last edited by
      #2

      Ok, I think the widgets inside the QVBoxLayout will change as you change the size of the Widget containing the QVBoxLayout.

      So my advice will be to set the size of the Widgets inside your QVBoxLayout to the same value everytime you change the size of the Widget containing the QVBoxLayout.

      But you might check the "QVBoxLayout ":http://qt-project.org/doc/qt-5.0/qtwidgets/qvboxlayout.html reference because there might be some property that could help you to acomplish this.

      In short, software is eating the world.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Buckets
        wrote on last edited by
        #3

        you can use setFixedSize(QSize) if you want the widget to stay a specific size or setMinimumSize.

        ba ba ba
        ba na na na

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pascom
          wrote on last edited by
          #4

          Hello,
          If you want to keep the relative dimensions of the widgets in you layouts (i.e the height of widget A. is two times the height of widget B and C and four times the height of widget D), you should use the strech factor which is the second argument of @QVBoxLayout::addWidget(QWidget* w, int strech)@

          Example :
          @
          layout->addWiget(widgetA, 4);
          layout->addWiget(widgetB, 2);
          layout->addWiget(widgetC, 2);
          layout->addWiget(widgetD, 1);
          @

          If you want to keep the aspect ration (i.e. the ratio height/width), I don't know any good solution (since this would involve adapting the width of the dialog).
          
          Hope it helps. Regards,
          

          --
          PasCom

          In a world without walls and fences, who needs Gates and Windows?

          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