I'm trying to set the maximum size of a qmainwindow by means of layouts / policies. For this I tested some things in Qt Designer.
When:
-I create a simple dialog
-put in there a textedit widget with a certain maximum size
-add a layout to the dialog with layoutSizeConstraint: SetMaximumSize
The dialog behaves as expected, I can resize, till I hit the maximum size of the child widget, then I can maximize the window no further.
When I do the same for a QMainWindow it does not work. The centralwidget stops resizing after hitting the maximum size, but the mainwindow simply grows more border space. (This is probably due to the custom layouthandler of the qmainwindow???)
(I know I can set maximumsize on the qmainwindow, but that is not a solution, because it would involve calculating all the extra border requirements for toolbars and the like. The size policies are used specifically to avoid that.)
Any idea on how to tackle this? (A QT designer example or some code would be great!)
The QT designer settings:
![]()
Bookmarks