Set fixed size of QMainWindow created in Designer
-
Good day, colleagues!
How can I fix size of QMainWindow created in Designer? Fix size means that I want to see main window as I created it in Designer without ability to resize.
I've tried this:
@ui->setupUi(this);
centralWidget()->layout()->setSizeConstraint(QLayout::SetFixedSize);@But got segfault.
-
You can also get the preferred size from the sizeHint() functionality and use that as the argument in the setFixedSize() call. That way if your central widget ever changes your app will automatically calculate the new preferred size - as long as the central widget implements a sensible sizeHint of course.
-
[quote author="vinb" date="1303204074"]@marko-a,
Its possible to set your maxsize the same as your minsize, but why do that if you have a nice function (setFixedSize) for it to do the job?[/quote]True, but the original question was:
[quote author="usamytch" date="1303198694"]
How can I fix size of QMainWindow created in Designer? Fix size means that I want to see main window as I created it in Designer without ability to resize.
[/quote]Thus if you wish to solve problem by using only Designer you can do so by setting minimum & maximum size constraints.
Cheers!