Open .ui file from Linux on Windows - qt

My colleague created a C++ Qt Project on Linux and I "transposed" it on Windows. Now, I am a functional GUI but I don't know why, when I open the .ui file with QtDesigner, the file is empty, all widgets disappeared.
Any idea how to get back my widgets or is it only because the file was created on QtDesigner on Linux ?
Here is a part of the ui file opened on Windows with a text editor:
<?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>874</width>
<height>497</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>541</width>
<height>331</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>860</width>
<height>700</height>
</size>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="buildMotionTab_3">
<attribute name="title">
<string>Tab 1</string>
</attribute>
<widget class="QFrame" name="centralFrame_3">
<property name="geometry">
<rect>
<x>-10</x>
<y>0</y>
<width>860</width>
<height>851</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>860</width>
<height>851</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>810</width>
<height>851</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QFrame" name="motorFrameP_3">
<property name="geometry">
<rect>
<x>260</x>
<y>10</y>
<width>281</width>
<height>280</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>280</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>280</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QSpinBox" name="LineDist">
<property name="geometry">
<rect>
<x>190</x>
<y>150</y>
<width>81</width>
<height>32</height>
</rect>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>470</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
[...]
<widget class="QPushButton" name="StandDownButton">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>101</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>StandDown</string>
</property>
</widget>
<widget class="QPushButton" name="Homing1Button">
<property name="geometry">
<rect>
<x>120</x>
<y>70</y>
<width>101</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Homing X</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>874</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

Looks like some thing went wrong in transporting the file (I can't say, but could be copy was done in binary mode? or some lines were not expanded in case you copied and pasted the text ..)
The ui xml you shared is broken at line 127 where it shows [...] which is not valid, in place of this it should show closing xml tags for </widget> , I think 4 closing tags </widget> are missing, then it should be ok.

Related

Qt6 migration - UIC generated code fails to compile (connect slots) - updated

I'm trying to port my project from Qt5 to Qt6.
My problem is that UIC generated code looks like this:
QObject::connect(SelectHome, &QToolButton::clicked, toQPSQLSettingUI, qOverload<>(&QWidget::selectHome));
MSVC2019 compilations fails with:
ui_toqpsqlsettingui.h(74,101): error C2039: 'selectHome': is not a member of 'QWidget'
C:\Qt\6.0.4\msvc2019_64\include\QtWidgets\qcompleter.h(57): message : see declaration of 'QWidget'
C:\Users\I542264\source\repos\tora\src\ui_toqpsqlsettingui.h(74,1): error C2065: 'selectHome': undeclared identifier
See the target is method is QWidget::selectHome, so IMHO MSVC is right: QWidget does not have method selectHome. But target should be sub-class method toQPSQLSettingUI::selectHome
Complete source is here. Initially created for Qt2, migrated to Qt3=>Qt4=>Q5.
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>toQPSQLSettingUI</class>
<widget class="QWidget" name="toQPSQLSettingUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>517</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Form1</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="PGSQL_HOME"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="TextLabel6_2_2_2">
<property name="toolTip">
<string>The default dateformat to use when querying the database.</string>
</property>
<property name="text">
<string>PgSQL home</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>PGSQL_HOME</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QToolButton" name="SelectHome">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>PGSQL_HOME</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>SelectHome</sender>
<signal>clicked()</signal>
<receiver>toQPSQLSettingUI</receiver>
<slot>selectHome()</slot>
<hints>
<hint type="sourcelabel">
<x>606</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>314</x>
<y>258</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<signal>signal1()</signal>
</slots>
</ui>

How to resize groupbox in QT Designer

I'm not sure if this is a bug or the way QT Designer was designed but I cannot resize any element on a QT widget with the 'blue boxes' one would expect to resize with. I also am not allowed to edit the minimum/maximum sizes to anything but zero. Are there some settings I need to change or is this just a bug?
.UI file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MeshGeneratorWidget</class>
<widget class="QWidget" name="MeshGeneratorWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>927</width>
<height>789</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Mesh Generator</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="AlignmentSceneviewerWidget" name="sceneviewer_widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>4</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QDockWidget" name="dockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>-10</y>
<width>492</width>
<height>771</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>492</width>
<height>557</height>
</size>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="allowedAreas">
<set>Qt::AllDockWidgetAreas</set>
</property>
<property name="windowTitle">
<string>Control Panel</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>472</width>
<height>388</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="time_groupBox">
<property name="title">
<string>Time:</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="timeValue_doubleSpinBox">
<property name="maximum">
<double>12000.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="timeLoop_checkBox">
<property name="text">
<string>Loop</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="timeValue_label">
<property name="text">
<string>Time value:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="timePlayStop_pushButton">
<property name="text">
<string>Play</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>234</height>
</size>
</property>
<property name="title">
<string>Adjust Data</string>
</property>
<widget class="QSlider" name="adjustData_Slider">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>431</width>
<height>22</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="minimum">
<number>-200</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>410</x>
<y>70</y>
<width>55</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>+2s</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>30</x>
<y>70</y>
<width>55</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-2s</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>60</x>
<y>170</y>
<width>201</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>View data with video</string>
</property>
</widget>
<widget class="QPushButton" name="viewVideo_button">
<property name="geometry">
<rect>
<x>180</x>
<y>90</y>
<width>121</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>View Video</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="video_groupBox">
<property name="title">
<string>Video:</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="frameIndex_label">
<property name="text">
<string>Frame index:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="framesPerSecond_spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="value">
<number>25</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="frameIndex_spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="framesPerSecond_label">
<property name="text">
<string>Frames per second:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QFrame" name="numFrames_frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="numFrames_label">
<property name="text">
<string># frames:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="numFramesValue_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>GroupBox</string>
</property>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>200</x>
<y>0</y>
<width>113</width>
<height>20</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="blackfynn_groupBox">
<property name="title">
<string>Blackfynn:</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="6" column="2">
<widget class="QPushButton" name="downloadData_button">
<property name="text">
<string>Download Data</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="blackfynnTimeSeries_pushButton">
<property name="toolTip">
<string>Retrieve time series</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>:/meshgeneratorstep/images/download-icon-blue.png</normaloff>:/meshgeneratorstep/images/download-icon-blue.png</iconset>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="QLineEdit" name="exportDirectory_lineEdit">
<property name="text">
<string>C:\Users\jkho021\Projects\MPB</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Export for WebGL</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="blackfynnDatasets_comboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="blackfynnDatasets_label">
<property name="text">
<string>Datasets:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="blackfynnDatasets_pushButton">
<property name="toolTip">
<string>Retrieve datasets</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>:/meshgeneratorstep/images/download-icon-blue.png</normaloff>:/meshgeneratorstep/images/download-icon-blue.png</iconset>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QComboBox" name="blackfynnTimeSeries_comboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="blackfynnTimeSeries_label">
<property name="text">
<string>Time series:</string>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Upload to Blackfynn</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QGroupBox" name="blackfynnProfiles_groupBox">
<property name="title">
<string>Profiles:</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QComboBox" name="profiles_comboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addProfile_pushButton">
<property name="toolTip">
<string>Add profile</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>:/meshgeneratorstep/images/plus-icon-green-th.png</normaloff>:/meshgeneratorstep/images/plus-icon-green-th.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QPushButton" name="viewAll_button">
<property name="text">
<string>View All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="done_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Done</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AlignmentSceneviewerWidget</class>
<extends>QWidget</extends>
<header>opencmiss/zincwidgets/alignmentsceneviewerwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>
Not a bug. As ekhumoro mentioned above, you can't resize widgets that are contained in a layout (not with Designer, anyway). You need to break the layout, then resize, then reapply the layout. Kind of a pain, I know, but after awhile you get used to it. The toolbar buttons make this go a lot faster, BTW.

PyQt 5 : How to save contents of the line edit into a txt file ? How to load the contents of a text file, to autofill the line edit?

I am trying to create a configuration tool that helps link attributes of one tool with another. I have created the config window using PyQt5.
I want to:
Save the value of the line edit, into a text file. ---> when clicked on Save
Load the values of a text file , into the line edit ---> when clicked on Load
This is how the UI looks
The UI of the config file- Config.ui
I have tried the functions getSaveFileName , getOpenFileName but all i get is the path on the cmd, and no actual file is saved or opened.
what should be done in order to save the file contents ?
Please be kind with your answers :)
This is how the programming GUI looks like :
# Config program using PyQt5
import sys
from PyQt5 import QtCore, QtGui, uic, QtWidgets
from PyQt5.QtWidgets import QFileDialog
form_class = uic.loadUiType("Config.ui")[0] # Load the UI
class Mapper(QtWidgets.QMainWindow, form_class):
def __init__(self, parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
self.setupUi(self)
# Bind the event handlers to the buttons
self.saveButton.clicked.connect(self.saveFileDialog)
self.loadButton.clicked.connect(self.loadFileDialog)
def saveFileDialog(self):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getSaveFileName(self, "QFileDialog.getSaveFileName()", "",
"All Files (*);;Text Files (*.txt)", options=options)
if fileName:
print(fileName)
def loadFileDialog(self):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
files, _ = QFileDialog.getOpenFileNames(self, "QFileDialog.getOpenFileNames()", "",
"All Files (*);;Python Files (*.py)", options=options)
if files:
print(files)
app = QtWidgets.QApplication(sys.argv)
myWindow = Mapper()
myWindow.show()
app.exec_()
This is how the Config.ui looks :
<?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>545</width>
<height>728</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="windowTitle">
<string>Configuration Window</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QFrame" name="mainFrame">
<property name="geometry">
<rect>
<x>20</x>
<y>-10</y>
<width>911</width>
<height>721</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QGroupBox" name="mapGroupBox">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>481</width>
<height>581</height>
</rect>
</property>
<property name="title">
<string>MAPPING ATTRIBUTES</string>
</property>
<widget class="QGroupBox" name="ecuGroupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>211</width>
<height>531</height>
</rect>
</property>
<property name="title">
<string>ECU TEST Attributes</string>
</property>
<widget class="QLabel" name="ModuleName">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>ModuleName</string>
</property>
</widget>
<widget class="QLabel" name="aObjectType">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>aObjectType</string>
</property>
</widget>
<widget class="QLabel" name="TestDescription">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>101</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TestDescription</string>
</property>
</widget>
<widget class="QLabel" name="Preconditions">
<property name="geometry">
<rect>
<x>10</x>
<y>390</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Preconditions</string>
</property>
</widget>
<widget class="QLabel" name="Testcase_ID">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Testcase_ID</string>
</property>
</widget>
<widget class="QLabel" name="function">
<property name="geometry">
<rect>
<x>10</x>
<y>330</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Function</string>
</property>
</widget>
<widget class="QLabel" name="Priority">
<property name="geometry">
<rect>
<x>10</x>
<y>300</y>
<width>55</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Priority</string>
</property>
</widget>
<widget class="QLabel" name="TestName">
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TestName</string>
</property>
</widget>
<widget class="QLabel" name="TestFocus">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TestFocus</string>
</property>
</widget>
<widget class="QLabel" name="Action">
<property name="geometry">
<rect>
<x>10</x>
<y>420</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Action</string>
</property>
</widget>
<widget class="QLabel" name="CreatedBy">
<property name="geometry">
<rect>
<x>10</x>
<y>480</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>CreatedBy</string>
</property>
</widget>
<widget class="QLabel" name="TestLocation">
<property name="geometry">
<rect>
<x>10</x>
<y>360</y>
<width>101</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TestLocation</string>
</property>
</widget>
<widget class="QLabel" name="Status">
<property name="geometry">
<rect>
<x>10</x>
<y>270</y>
<width>55</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Status</string>
</property>
</widget>
<widget class="QLabel" name="Req_ID">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>55</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Req_ID</string>
</property>
</widget>
<widget class="QLabel" name="TestPictureName">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TestPictureName</string>
</property>
</widget>
<widget class="QLabel" name="ExpectedResult">
<property name="geometry">
<rect>
<x>10</x>
<y>450</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<family>Nirmala UI</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>ExpectedResult</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="doorsGroupBox">
<property name="geometry">
<rect>
<x>250</x>
<y>29</y>
<width>211</width>
<height>531</height>
</rect>
</property>
<property name="title">
<string>DOORS Attributes</string>
</property>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_3">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_4">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_5">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_6">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_7">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_8">
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_9">
<property name="geometry">
<rect>
<x>10</x>
<y>270</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_10">
<property name="geometry">
<rect>
<x>10</x>
<y>300</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_11">
<property name="geometry">
<rect>
<x>10</x>
<y>330</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_12">
<property name="geometry">
<rect>
<x>10</x>
<y>360</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_13">
<property name="geometry">
<rect>
<x>10</x>
<y>390</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_14">
<property name="geometry">
<rect>
<x>10</x>
<y>420</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_15">
<property name="geometry">
<rect>
<x>10</x>
<y>450</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_16">
<property name="geometry">
<rect>
<x>10</x>
<y>480</y>
<width>181</width>
<height>22</height>
</rect>
</property>
</widget>
</widget>
</widget>
<widget class="QPushButton" name="saveButton">
<property name="geometry">
<rect>
<x>30</x>
<y>630</y>
<width>93</width>
<height>28</height>
</rect>
</property>
<property name="toolTip">
<string>Save The Current Configuration</string>
</property>
<property name="toolTipDuration">
<number>1</number>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
<widget class="QPushButton" name="loadButton">
<property name="geometry">
<rect>
<x>140</x>
<y>630</y>
<width>93</width>
<height>28</height>
</rect>
</property>
<property name="toolTip">
<string>Load Existing Configuration</string>
</property>
<property name="toolTipDuration">
<number>1</number>
</property>
<property name="text">
<string>Load</string>
</property>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>545</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

Widgets are not placed as expected in Qt Designer

I created the custom widget which has buttons in a horizontal layout.
But buttons are not placed correctly and shrink.
I can avoid this by setting the button size manually.
Is there any way to avoid this behavior automatically?
.ui XML code:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VideoPlaybackWidgetBase</class>
<widget class="QWidget" name="VideoPlaybackWidgetBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>790</width>
<height>58</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>58</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QFrame" name="horizontalFrame">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="moveFirstButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="movePrevButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="playButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="moveNextButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="moveLastButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
I see Maximum size policy in the XML. Go to buttons' properties in Designer, and change size policy for example to Expanding. Also make sure the button widths are same (or with the right ratio if you want different width buttons).
Alternatively, you can keep the Maximum policy and just increase the width to what ever you want to be the maximum button width, like 2000 to allow for 10000 pixel wide future displays... There are many ways to achieve desired sizing behavior. Choose what best describes what you want, in this case perhaps MinimumExpanding.
See QSizePolicy docs.

Why does enabling word wrap for a QLabel alter the layout?

So i have a small program i've made with Qt Designer, and for the most part, it's completely fine. But there is one niggling problem;
I have a QLabel, for which the text is sometimes too long, so i want to make the text wrap. This should be a simple task.
Here is what it looks like with no wordwrap
And this is fine. But when the text gets too long, it puts in a horrible scroll bar. I don't want this, so i enable wordwrap. But then this happens:
Which at first i thought was just Qt Designer being crap, so compiled and run hoping it would go away. Sometimes this happens, so i thought it was a reasonable assumption.
It wasn't.
Why the hell is this happening?!
EDIT: enabling word wrap manually in the widget initialiser also causes the same behaviour - so it's not caused by Qt Designer, it's an issue elsewhere. Any help would be greatly appreciated!
Here is the content of 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>705</width>
<height>347</height>
</rect>
</property>
<property name="windowTitle">
<string>Title</string>
</property>
<property name="windowIcon">
<iconset resource="icons.qrc">
<normaloff>:/icons/icons/3/bonus48x48_20.png</normaloff>:/icons/icons/3/bonus48x48_20.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,1">
<item row="1" column="0">
<widget class="QLabel" name="label_molecule">
<property name="text">
<string>Molecule:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_molecule"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QToolBox" name="toolBox_modelDetails">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_isomer">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>373</width>
<height>154</height>
</rect>
</property>
<attribute name="label">
<string>Isomer</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="listWidget_isomers">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_model">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>357</width>
<height>231</height>
</rect>
</property>
<attribute name="label">
<string>Model</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0">
<item>
<widget class="QListWidget" name="listWidget_models">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<stylestrategy>PreferDefault</stylestrategy>
</font>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_description">
<property name="text">
<string>Howdy!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_basisSet">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>373</width>
<height>154</height>
</rect>
</property>
<attribute name="label">
<string>Basis Set</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QListWidget" name="listWidget_basisSets">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_buttons">
<item>
<spacer name="horizontalSpacer_buttons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_save">
<property name="text">
<string>Save Input File</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_open">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2" rowspan="2">
<widget class="QGroupBox" name="groupBox_MoleculeViewer">
<property name="title">
<string>Molecule</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources>
<include location="icons.qrc"/>
</resources>
<connections/>
</ui>
QLabel in combination with word wrap and Layouts give some funny behaviour.
See https://bugreports.qt.io/browse/QTBUG-37673.
Why are you nesting your widgets (the QLabel and the QListWidget) into a QWidget?
That's why you are getting two scrollbars. One from the QListWidget, because it has more items than can be viewed. And one for the parent QWidget.
You should be using layouts.
This is what you have:
Should be something like this:

Resources