QDialog with fixed size
-
wrote on 11 Aug 2022, 18:09 last edited by
Hello,
I've come upon this problem several times:
I have a class that inherits from QDialog and I just want to make it lets say 500x500 pixels in size, no matter on if the widgets on it need that space or not.I've tried:
- dialog->setFixedSIze();
- dialog->window()-setFixedSize();
- Reimplementing sizeHint() and minimumSizeHint()
- window()->layout()->setSizeConstraint( QLayout::SetFixedSize ); then resize or rezise and then set contraints
nothing works, so what am I missing?
What I used as work around some times it so resize the widgets in the dialog to push it out, but that cannot be the right method.
-
Hi,
Can you post a minimal compilable sample code that shows the behaviour ?
Which version of Qt are you using ?
On which platform ? -
wrote on 11 Aug 2022, 18:24 last edited by
Setting up the minimal example brought me to the solution :)
I had
main_layout->setSizeConstraint(QLayout::SetFixedSize);
in the constructor from copy pasting from another dialog.
Removing it fixed it.Thanks
1/3