Auto resize contents when dialog is resized?
Solved
General and Desktop
-
I've added a QFormLayout to the centralWidget, the layoutFieldGrowthPolicy is set to ExpandingFieldsGrow, all the labels and other widgets have been added to the form layout, but when I resize the dialog, nothing happens, everything stays the same size...what haven't I done?
-
@SPlatten said in Auto resize contents when dialog is resized?:
what haven't I done?
Without more information (code or design screen-shot) hard to say. Probably you did not apply the layout to the dialog.
-
@jsulm , here is the XML for the UI file:
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>519</width> <height>409</height> </rect> </property> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralWidget"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <widget class="QWidget" name="formLayoutWidget"> <property name="geometry"> <rect> <x>10</x> <y>0</y> <width>501</width> <height>391</height> </rect> </property> <layout class="QFormLayout" name="formLayout"> <property name="fieldGrowthPolicy"> <enum>QFormLayout::ExpandingFieldsGrow</enum> </property> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text"> <string>Received:</string> </property> </widget> </item> <item row="2" column="0"> <widget class="QLabel" name="label_2"> <property name="text"> <string>Response:</string> </property> </widget> </item> <item row="1" column="0" colspan="2"> <widget class="QListWidget" name="plwRx"/> </item> <item row="3" column="0" colspan="2"> <widget class="QListWidget" name="plwTx"/> </item> </layout> </widget> </widget> <widget class="QToolBar" name="mainToolBar"> <attribute name="toolBarArea"> <enum>TopToolBarArea</enum> </attribute> <attribute name="toolBarBreak"> <bool>false</bool> </attribute> </widget> </widget> <layoutdefault spacing="6" margin="11"/> <resources/> <connections/> </ui>
And a screenshot of the layout in Qt Creator: