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. Resizeable QDialog with QStackWidget
Forum Updated to NodeBB v4.3 + New Features

Resizeable QDialog with QStackWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 525 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
    Andaharoo
    wrote on last edited by
    #1

    I need some layout help. I wanted a QDialog that resizes to fit contents. So the contents change and it resizes. I found I could set the widgets in the layout to an expanding size policy and then QApplication::processEvents(); adjustSize(); to get it to resize to fit the contents.

    But I want to use a stackwidget in it and can't get it to work. So for example,

    • Dialog
      • Some widgets here and there
      • QStackWidget
        • Page1
        • Page2

    Now page 1 and 2 have different contents. And page2's minimum size is larger than page1's as it has more widgets. The widgets in the stack widget are always their minimum size in either page. Like they're supposed to be. But the widgets outside of the stack widget are only their minimum size on the largest page.

    All the widgets have a vertical expanding size policy and when the page changes processEvents and adjustSize is called.

    Here's a screenshot of the dialog with each page. The stackwidget is highlighted in red.
    0_1528507477473_screenshot.png

    So how can I make the dialog shown on the right be minimum size? IE: The image combo box, text box, and cancel and export buttons are all larger than expected.

    1 Reply Last reply
    0
    • KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by
      #2

      Maybe, you can use a vertical spacer to force the minimum size of elements

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved