Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED] Designer: how to make a form layout auto adjusting its size?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Designer: how to make a form layout auto adjusting its size?

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 3 Posters 13.5k 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.
  • F Offline
    F Offline
    fluca1978
    wrote on last edited by
    #1

    Hello,
    I'm designing a window with the QtDesigner. The window is organized into two columns, each one managed by a specific layout (vertical layout on the left, form layout on the right). I'd like to have the right column to auto-adjust its size when the window is resized too, but actually this does not happen. How should I place components and layout in the window?

    Thanks

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

      If you're using QMainWindow, remember to call setCentralWidget() with your main layout - it will stretch to cover the whole main window, and resize with it.

      Then, to make only one of the layouts resizable, you'll have to dive into layout's properties, set sizeConstraint to desired. You can also adjust widgets' (ones inside your layout) size policy with setSizePolicy(). More:

      "QWidget doc":http://developer.qt.nokia.com/doc/qt-4.7/qwidget.html#id-caf2280e-729f-43c8-9f95-f9415d0f5a33

      "QMainWindow":http://developer.qt.nokia.com/doc/qt-4.7/qwidget.html

      "QLayout":http://developer.qt.nokia.com/doc/qt-4.7/qlayout.html

      Oh, and I've mixed a bit things from code itself with things from QtDesigner.

      (Z(:^

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

        The trick is this:

        In your form, place two QWidgets, one for each of the pannels. Put those two widgets in a horizontal layout. now, set the size policies of the widgets, so that the left one is fixed, and the right one is minimumExpanding. Next, put the contents of your form sides inside these widgets, and again apply a layout to each of the created "panels". Note that you can also use some other widget (like QFrame or QGroupbox) instead of QWidget if that suits your needs better.

        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