QDockWidget ignores layouts and size policy from the form
-
Hello!
I'm subclassing from QDockWidget and I want my class to use form. I've made a form based on QWidget and included ui class in my QDockWidget based class. But the build result differs from the Qt Designer preview, because QDockWidget completely ignores all the preset size policies and layouts from the form. My form looks fine if used in a QMainWindow-based class and also in a QWidget-based, but not in a QDockWidget-based. How to use forms for QDockWidget? -
That's not how you're supposed to use QDockWidget. It already has a layout and adds stuff to it dynamically, e.g the title bar. Subclassing it and trying to impose the ui stuff messes with its internals.
Don't subclass QDockWidget. Instead make a normal QWidget with all the designer ui stuff and add it to a plain dock via QDockWidget::setWidget().