Nested structures with QRadioButtons - qt

I would like to achieve something similar to this picture:
except that the top level ("Adress bar", "forms" and "User names...") should be radio buttons.
The idea is that the sublevels should get enabled or disabled depending on the state of the radiobuttons. And the sublevels should be shifted to the right as on the picture.
Can that be done Qt in an elegant way?

I would say a simple QVBoxLayout for the top level and each "sublevel" has a QHBoxLayout with a fixed sized spacer item as the first child and a QVBoxLayout containing the sub options.
Disabling all sub options can then simply be done by disabling the "sublevel" widget.

Just put those sub-items (like "Browsing history", "Favorites", ...) into a separated QWidget and connect that widget's QWidget::setEnabled() slot with the "Adress bar" radio-button's QAbstractButton::toggled() signal.
This is a Qt Designer's .ui file (with working signal-slot connection, try Ctrl+R in Designer) that demonstrates the idea:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>170</width>
<height>178</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>RadioButton</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>radioButton</sender>
<signal>toggled(bool)</signal>
<receiver>widget</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>84</x>
<y>17</y>
</hint>
<hint type="destinationlabel">
<x>84</x>
<y>77</y>
</hint>
</hints>
</connection>
</connections>
</ui>

Related

Qt Designer: how to remove empty space around QTableWidget

The Question is like said in the Title, how can i remove the Empty Space in the QTableWidget in the QT Designer?
Here is a screenshot of it:
More important is the white space below and not the whie spaces on the right!
the QTableWidget is inside a Vertical Layout and underneath the Layout is a Vertical Spacer
with these Propertys:
Here are the Vertical Layout Propertys:
It can be done with sizeAdjustPolicy, which is located in the QAbstractScrollArea section of the Property Editor in Qt Designer. When this is combined with a Minimum size-policy on the table (and possibly also hidden scrollbars), it should achieve what you want:
However, it should be noted that the size-adjust-policy doesn't seem to handle hidden table-headers properly (which looks like a bug).
Here's a demo designer ui file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>392</width>
<height>199</height>
</rect>
</property>
<property name="windowTitle">
<string>Test</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Table</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<row>
<property name="text">
<string>1</string>
</property>
</row>
<row>
<property name="text">
<string>2</string>
</property>
</row>
<column>
<property name="text">
<string>A</string>
</property>
</column>
<column>
<property name="text">
<string>B</string>
</property>
</column>
<column>
<property name="text">
<string>C</string>
</property>
</column>
</widget>
</item>
<item>
<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>
</layout>
</widget>
<resources/>
<connections/>
</ui>

QFormLayout does not expand widget full height to maximum widget height

I have an issue with getting a QTreewidget full height inside a QFormLayout. I'm on Windows 10 and use QT 5.7
Things I tried:
all possible Vertical policy's without success. Change the
FieldGrowthPolicy of the layout to AllNonFixedFieldsGrow
Use another widget, all fail to make this work
That's all the options I found to possibly make this work.
Here's what I try to achieve:
Here's my ui file:
<?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>760</width>
<height>747</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Please grow the treeview:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QTreeWidget" name="treeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Please read the Qt tutorials about layouts.
I added a two layouts and a spacer to your ui file.
<?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>489</width>
<height>215</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Please grow the treeview:</string>
</property>
</widget>
</item>
<item>
<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>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Based on this answer: Qt formlayout not expanding qplaintextedit vertically which worked for me, setting the Vertical Stretch attribute to something other than 0 should do the trick.

Can't get a widget to grow properly when I resize the window

I made a form that looks like this: . The .ui is below.
The QTextEdit on the right is the only widget that has it's horizontal size policy set to Expanding. All the other widgets are either Preferred or Minimum. Yet when I resize the window horizontally, the text edit is the only widget that does not grow. It stays the same size while all the other widgets expand horizontally.
I guess there's something that I don't understand about how all of that works. What do I have to do to make the text edit expand when I resize the window?
.ui file
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWidget</class>
<widget class="QWidget" name="MainWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>634</width>
<height>303</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="4" rowspan="7" colspan="2">
<widget class="QTextEdit" name="textEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Data written:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="readSpeedLabel">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Write speed:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Test Mode:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="dataWrittenLabel">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Read speed:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QPushButton" name="testModePushButton">
<property name="text">
<string>Select testing mode</string>
</property>
</widget>
</item>
<item row="9" column="2" colspan="2">
<widget class="QPushButton" name="startStopButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Start test</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QPushButton" name="devicePushButton">
<property name="text">
<string>Select device</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QLabel" name="ETALabel">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="writeSpeedLabel">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>ETA:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="dataReadLabel">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Data Read:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="0" colspan="4">
<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="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Device:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
It is the QLabel items which are messing your layout.
Set the horizontal size policy to Fixed for every QLabel and it works.
Now the answer to why QLabels with Preferred are growing faster than the QTextEdit with an Expanding policy, I do not know. Especially when changing Preferred to Fix solves the problem.
Qt documentation states :
QSizePolicy::Expanding The widget can make use of extra space, so it should get as much space as possible.
QSizePolicy::Preferred The widget can be expanded, but there is no advantage to it being larger than sizeHint().
QSizePolicy::Fixed The QWidget::sizeHint() is the only acceptable alternative, so the widget can never grow or shrink.
Looking at this, it seems that a widget with Preferred would not grow bigger than sizeHint() when next to another widget with Expanding. But in your case labels behave like they have the priority over the text edit.
Note that this does not seem to be the case for QPushButton.
It looks like a bug to me.

Qt Designer misaligning items correctly configured

I'm trying to display some items in Qt Designer, but I'm being unable to do it because despite I correctly place them in the .ui, when I compile and run the code, the items are misplaced:
You can notice by the images above that what I want is in the left side: the four items inside the QStackedWidget perfectly aligned with other items, but what I get is what is in the right part: all four items inside the QStackedWidget are misaligned.
I tried to manipulate the variables related to margin etc. as much as possible but I simply can't understand why the app is showing something different from what was programmed. Any tip on how to solve this problem?
UPDATE
Adding the following image to help in comments of a given answer below:
UPDATE
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>306</width>
<height>229</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>306</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>306</width>
<height>229</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout_4">
<item row="3" column="1">
<widget class="QPushButton" name="pbUpdate">
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="horizontalSpacer_2">
<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 row="3" column="2">
<spacer name="horizontalSpacer_3">
<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 row="0" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pbFullUpdate">
<property name="text">
<string>Full update</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSingleFile">
<property name="text">
<string>Single file</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>89</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0" colspan="3">
<widget class="QStackedWidget" name="swInfo">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Version ID:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pbVersionIDIncrease1">
<property name="maximumSize">
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="text">
<string>^</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pbVersionIDIncrease2">
<property name="maximumSize">
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="text">
<string>^</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pbVersionIDIncrease3">
<property name="maximumSize">
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="text">
<string>^</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leID">
<property name="text">
<string>33.4550.1</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<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>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<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 row="0" column="1">
<widget class="QLineEdit" name="leServerAddress">
<property name="minimumSize">
<size>
<width>186</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>186</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Server path:</string>
</property>
<property name="buddy">
<cstring>leServerAddress</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lePathToSave">
<property name="minimumSize">
<size>
<width>186</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>186</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>/mmcblk0p2/</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Path to save:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Equipment IP:</string>
</property>
<property name="buddy">
<cstring>leEquipmentIP</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="leEquipmentIP">
<property name="minimumSize">
<size>
<width>186</width>
<height>33</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>186</width>
<height>33</height>
</size>
</property>
<property name="text">
<string>10.1.25.10</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>leEquipmentIP</tabstop>
<tabstop>pbUpdate</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
There is no reason why the two rows of widgets in the middle should line up with the outer ones, given that they are not part of the same layout.
This should be more obvious if the text in the bottom lable is made longer:
So it seems your conclusion is backwards: it's actually the compiled version that is correct, and the Qt Designer version which needs further explanation. But without being able to test the real ui file, it's hard to say much more than that.
UPDATE:
If the maximum/minimum size is reset to the default for MainWindow and leEquipmentIP, you can more easily see what's going on.
When the window is resized horizontally, the spacing between the labels and the line-edits changes at different rates. So there is a critical width for the window where the line-edits will be perfectly aligned. For me, this width is 303 pixels, but the exact value may depend on things like the window type, current widget style, current window decoration, etc.
This is probably enough to explain why Qt Designer may sometimes display things differently. For instance, on my system, I use the Docked Window interface mode, and so forms are displayed as MDI windows. This means they get a different window decoration to top-level windows (such as Qt Designer itself), and so their external frame dimensions may be slightly different.
Have you tried to use Form Layout (having two columns like in form)
Update:
I used form layouts for above and below part. In the middle there is stacked widget.
The right side of line inputs is aligned properly, also the left side is also aligned properly. I achieved this by setting all margins of stacked widget to 0 and form layouts margins were already at 0.
Also I used vertical layout for whole form, this was necessary for proper alignment of three layouts together.
The problem is how to align that part between end of labels and start of line edits. I think this is not possible without hacking the min/max size of labels or whatever is on the left.
Maybe some change in design if possible would be better than to hack the (middle) alignment between different layouts (which I think is not possible).
Update 2:
Ok I took your ui file, placed in my QtCreator test project and the result is good - I do not have the problem of croped line edits as you show in your Updated screenshot. Maybe there is some residual resizing of whole window - what happen if you resize the window. Whatever I am doing I cannot trigger the same behaviour - the line edits are properly aligned all the time.
The remaining questions are - what is your QtCreator version, Qt version, OS.
Mine is QtCreator 3.3.2 Qt 5.4.1 Kubuntu 14.04

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