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. Widget stretching

Widget stretching

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.6k 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.
  • T Offline
    T Offline
    TheDestroyer
    wrote on last edited by
    #1

    Hello guys, :)

    I have a QMainWindow dialog that contains 2 other widgets sorted vertically (everything is done with coding, not with forms). The top one is an openGL simulation. The bottom one is the options for the openGL implementation, which is another child widget of my QMainWindow.

    The problem is the following. Obviously, the options widget has to be very small compared to the openGL widget. But the QMainWindow is splitting them in halves vertically, which streches the options window and makes it look bad.

    I would like the options widget to be vertically as small as possible vertically to fit all the controls in it, but horizontally streched.

    Any efforts are highly appreciated!

    Thank you in advance :-)

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      "Size policies":http://doc.qt.nokia.com/4.7/qwidget.html#sizePolicy-prop and "stretch":http://doc.qt.nokia.com/4.7/qboxlayout.html#setStretch factors are your friends...

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TheDestroyer
        wrote on last edited by
        #3

        Thanks a lot buddy. Got it :D

        For other people to learn it! :)

        @
        optionsWidgetDialog->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
        @

        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