Important: Please read the Qt Code of Conduct -

Stop a QDialog getting above a certain height, or make it resizeable by dragging the top, or make it accept being moved off the top of the screen

  • I'm trying to stop a QDialog being too tall.

    I set its vertical size policy to maximum. I gave it a baseSize Height of 700. I set the maximumSize Height to 700. It still comes out too tall (far more than 700 pixels).

    What else can I try to stop it being taller than 700 pixels?

    Alternatively, I could manually resize it, except that the top of the dialog isn't draggable. The right side and left side can be dragged to resize horizontally, and the bottom edge could be dragged to resize vertically if only the bottom edge was on screen, but the top edge doesn't drag. So how can I make the top edge draggable?

    Alternatively to that, I could drag the whole window upwards via ALT+LEFT_MOUSE+MOUSE_MOVE until the bottom edge appears, and then resize it by dragging the bottom edge; except that when I try to do that it refuses to let the top level QDialog move off the top of the screen. The parent dialog behind it moves off the screen, though. So how can I make it so I'm allowed to drag the QDialog off screen so I can see the bottom edge so I can resize it?

  • Lifetime Qt Champion

    It seems like if QDialog has a layout, the Maxsize don't work.
    however setting this on the inner layout
    OptionDialog d;
    d.layout()->setSizeConstraint (QLayout::SetMaximumSize);

    Made the dialog, only be the MaximumSize.MaxHeight set in designer.
    all other values at default.
    Not sure its your case too.

Log in to reply