pyuic4 seems to generate a wrong layout based on a .ui file from Qt Designer. The UI file is here:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>348</width>
<height>267</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="text">
<string><html><head/><body><p align="center"><span style=" font-size:14pt;">Some Text</span></p></body></html></string>
</property>
</widget>
</item>
<item alignment="Qt::AlignTop">
<widget class="Line" name="line_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignBottom">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item alignment="Qt::AlignBottom">
<widget class="QPushButton" name="btn_customize">
<property name="text">
<string>Customize</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignBottom">
<widget class="QPushButton" name="btn_done">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
In this layout, I'm trying to align a pair of buttons with the bottom of the dialog window and some text with the top. Running pyuic4 test.ui --preview
shows all objects aligned to the center horizontally, instead of to the top and bottom (and displaying this dialog from the actual python program shows the same results). By comparison, pyuic5 test.ui --preview
seems to be more along the lines of what I wanted to get.
If it helps, my version of pyuic4 is 4.11.4 and I'm on Ubuntu 16.04.
Any ideas? Am I doing something wrong? Or is there perhaps a newer pyuic4 out there?