Layout and expanding dialog issue



  • I am trying to design a window that will expand and show a QGroupBox when the "Match" button is clicked. In my MainWindow constructor, I call:
    @ ui->matchingGroupBox->hide();
    layout()->setSizeConstraint(QLayout::SetFixedSize);@

    As such, my problem comes in when I apply a GridLayout or Vertical layout to the MainWindow.
    I want it to look like the left pic at execution. But after I apply a grid or vertical layout to the mainWindow, I get the right pic.
    !http://snag.gy/GQAMo.jpg(No Layout Applied)! .............!http://snag.gy/0FowC.jpg(Layout Applied)!

    At runtime, the Match button does work, hiding the groupBox and resizing the MainWindow. My theories are (1) one of the widgets in the top section is expanding. And (2) the textEdit in the Matching Group Box is vertically expanding. I've set all size policies to Fixed so I'm stumped. I'm clearly missing some obvious concept behind layouts here. Any help us much appreciate and let me know more info is needed.



  • If the top layout has a size policy of Fixed then its width will be fixed at the size dictated by the size hints returned by the contained widgets. Note that this is not necessarily related to the current size in the Designer.

    A QGridLayout may have an empty cell to the right of the lower QGroupBox that can be eliminated by dragging the right-hand side of the group box across and then select Simplify Grid Layout.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.