I am making the GUI of my software with QT Designer.
My GUI has some tabs which I successfully managed to auto-resize in full width when the user makes fullscreen the GUI on his computer.
Then inside each tab, I need to insert a Toolbox. But this time, I didn't succeed in auto-resize this toolbox when the user makes the GUI full screen.
I think the best way to explain to you my issue is to have a look at my screenshots: My GUI in QT designer:
The preview with the issue:
You can see on the preview that the toolbox is keeping the same size when I go for fullscreen.
You need to add a layout to tab_Run
, e.g. by selecting tabWidget
and pressing Ctrl+L
(on Windows), so your tree would look like this:
Note: In general, you have to set a layout for every widget, the size of whos children you want to be managed automatically by Qt.
As a reference, here is the ui
-file I have created:
<?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>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_Run">
<attribute name="title">
<string>Run</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QToolBox" name="toolBox">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>443</height>
</rect>
</property>
<attribute name="label">
<string>Page 1</string>
</attribute>
</widget>
<widget class="QWidget" name="page_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>443</height>
</rect>
</property>
<attribute name="label">
<string>Page 2</string>
</attribute>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_Campaigns">
<attribute name="title">
<string>Campaigns</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_Settings">
<attribute name="title">
<string>Settings</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_Help">
<attribute name="title">
<string>Help</string>
</attribute>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
Here is the produced result: