QstackedWidget adding space for arrows when arranged vertically - qt

I have a ui file, like this:
<?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>377</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="QStackedWidget" name="top_pages">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QFrame" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QStackedWidget" name="stackedWidget_2">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>GroupBox</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4"/>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>GroupBox</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6"/>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QFrame" name="page_2"/>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>377</width>
<height>19</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
I want the groupboxes to be shown in the whole window( the groupbox text to be just below the menus. When I build this in an application and look at in the qt designer preview it leaves a space at the top where the arrows of top_pages are located. How would I make the group box extend into this space? I can break the layout and extend it into this space but I think this would require doing this for every page of stackedWidget_2.

Does this produce the layout you're trying to achieve?
<?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>377</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="top_pages">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QFrame" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="stackedWidget_2">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>GroupBox</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4"/>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>GroupBox</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="topMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QFrame" name="page_2"/>
</widget>
</item>
</layout>
</widget><?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>377</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="top_pages">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QFrame" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="stackedWidget_2">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>GroupBox</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4"/>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>GroupBox</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="topMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QFrame" name="page_2"/>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>377</width>
<height>23</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>377</width>
<height>23</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
All I did was go through all of widgets and reduced their layout's top margin to 0 by selecting them in the object editor (centralWidget, page, page_3, page_4), and modifying their layout properties in the property editor. No layout breaking needed.

<?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>676</width>
<height>595</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>GroupBox</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Some text </span></p></body></html></string>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="top_pages">
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QFrame" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2"/>
</widget>
<widget class="QFrame" name="page_2"/>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>676</width>
<height>18</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
I think this is what you are trying to create. There were couple of stack widgets. I made it one.Just for indication I have added box frame around the stacked widget. It can be easily removed from the properties

Related

Change different object's stylesheet Qt Designer

How to change the stylesheet of a different object? Essentially, when I hover over an object, I want it to change a different object's stylesheet (in this case the background colour).
Entire XML Code for UI:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>addClan</class>
<widget class="QMainWindow" name="addClan">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1070</width>
<height>720</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="background_image">
<property name="geometry">
<rect>
<x>-10</x>
<y>0</y>
<width>1081</width>
<height>741</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/addClan/background image.png);</string>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QGroupBox" name="clans_list">
<property name="geometry">
<rect>
<x>110</x>
<y>100</y>
<width>861</width>
<height>401</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox#clans_list{
border: 2px solid gray;
border-color: #424242;
background-color: white;
}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QGroupBox" name="saved_clan_0">
<property name="geometry">
<rect>
<x>1</x>
<y>0</y>
<width>859</width>
<height>80</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox{
border: 1px solid gray;
border-color: #424242;
background-color: white;
}
QGroupBox:hover{
background-color: red;
}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="clan_shield_0">
<property name="geometry">
<rect>
<x>5</x>
<y>6</y>
<width>68</width>
<height>68</height>
</rect>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="clan_name_0">
<property name="geometry">
<rect>
<x>90</x>
<y>18</y>
<width>561</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QFrame" name="frame_0">
<property name="geometry">
<rect>
<x>1</x>
<y>1</y>
<width>857</width>
<height>78</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QFrame {
background-color: white;
}
QFrame:hover {
background-color: rgb(227, 227, 227);
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
<zorder>frame_0</zorder>
<zorder>clan_name_0</zorder>
<zorder>clan_shield_0</zorder>
</widget>
<widget class="QGroupBox" name="saved_clan_1">
<property name="geometry">
<rect>
<x>1</x>
<y>80</y>
<width>859</width>
<height>80</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox{
border: 1px solid gray;
border-color: #424242;
background-color: white;
}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="clan_shield_1">
<property name="geometry">
<rect>
<x>5</x>
<y>6</y>
<width>68</width>
<height>68</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="clan_name_1">
<property name="geometry">
<rect>
<x>90</x>
<y>18</y>
<width>561</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QFrame" name="frame_1">
<property name="geometry">
<rect>
<x>1</x>
<y>1</y>
<width>857</width>
<height>78</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QFrame {
background-color: white;
}
QFrame:hover {
background-color: rgb(227, 227, 227);
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
<zorder>frame_1</zorder>
<zorder>clan_name_1</zorder>
<zorder>clan_shield_1</zorder>
</widget>
<widget class="QGroupBox" name="saved_clan_2">
<property name="geometry">
<rect>
<x>1</x>
<y>160</y>
<width>859</width>
<height>80</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox{
border: 1px solid gray;
border-color: #424242;
background-color: white;
}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="clan_shield_2">
<property name="geometry">
<rect>
<x>5</x>
<y>6</y>
<width>68</width>
<height>68</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="clan_name_2">
<property name="geometry">
<rect>
<x>90</x>
<y>18</y>
<width>561</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QFrame" name="frame_2">
<property name="geometry">
<rect>
<x>1</x>
<y>1</y>
<width>857</width>
<height>78</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QFrame {
background-color: white;
}
QFrame:hover {
background-color: rgb(227, 227, 227);
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
<zorder>frame_2</zorder>
<zorder>clan_name_2</zorder>
<zorder>clan_shield_2</zorder>
</widget>
<widget class="QGroupBox" name="saved_clan_3">
<property name="geometry">
<rect>
<x>1</x>
<y>240</y>
<width>859</width>
<height>80</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox{
border: 1px solid gray;
border-color: #424242;
background-color: white;
}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="clan_shield_3">
<property name="geometry">
<rect>
<x>5</x>
<y>6</y>
<width>68</width>
<height>68</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="clan_name_3">
<property name="geometry">
<rect>
<x>90</x>
<y>18</y>
<width>561</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QFrame" name="frame_3">
<property name="geometry">
<rect>
<x>1</x>
<y>1</y>
<width>857</width>
<height>78</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QFrame {
background-color: white;
}
QFrame:hover {
background-color: rgb(227, 227, 227);
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
<zorder>frame_3</zorder>
<zorder>clan_name_3</zorder>
<zorder>clan_shield_3</zorder>
</widget>
<widget class="QGroupBox" name="saved_clan_4">
<property name="geometry">
<rect>
<x>1</x>
<y>320</y>
<width>859</width>
<height>80</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox{
border: 1px solid gray;
border-color: #424242;
background-color: white;
}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="clan_shield_4">
<property name="geometry">
<rect>
<x>5</x>
<y>6</y>
<width>68</width>
<height>68</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="clan_name_4">
<property name="geometry">
<rect>
<x>90</x>
<y>18</y>
<width>561</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QFrame" name="frame_4">
<property name="geometry">
<rect>
<x>1</x>
<y>1</y>
<width>857</width>
<height>78</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QFrame {
background-color: white;
}
QFrame:hover {
background-color: rgb(227, 227, 227);
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
<zorder>frame_4</zorder>
<zorder>clan_name_4</zorder>
<zorder>clan_shield_4</zorder>
</widget>
</widget>
<widget class="QPushButton" name="add_clan_button">
<property name="geometry">
<rect>
<x>109</x>
<y>520</y>
<width>861</width>
<height>81</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>14</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0.0511364, y1:0.5, x2:0.938, y2:0.534091, stop:0 rgba(231, 163, 4, 255), stop:1 rgba(238, 211, 4, 255));
color: white;
border-radius: 10;
padding: 6;
border-style: outset;
border-width: 1;
border-top-color: rgb(135, 135, 135);
border-left-color: rgb(135, 135, 135);
border-right-color: rgb(0, 0, 0);
border-bottom-color: rgb(0, 0, 0);
}
QPushButton:pressed {
border-style: outset;
border-top-color: rgb(0, 0, 0);
border-left-color: rgb(0, 0, 0);
border-right-color: rgb(135, 135, 135);
border-bottom-color: rgb(135, 135, 135);
}</string>
</property>
<property name="text">
<string>ADD NEW CLAN</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QGroupBox" name="add_clan_group">
<property name="geometry">
<rect>
<x>220</x>
<y>150</y>
<width>631</width>
<height>301</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox {
border: 2px solid gray;
border-color: #424242;
border-radius: 15px;
background-color: white
}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="clan_tag_label">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>191</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Clan Tag</string>
</property>
</widget>
<widget class="QLineEdit" name="clan_entry">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>461</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>Calibri</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(222, 222, 222);
border-radius: 7;
border: 1px solid black</string>
</property>
<property name="text">
<string>#</string>
</property>
<property name="placeholderText">
<string>#</string>
</property>
</widget>
<widget class="QPushButton" name="search_clan_button">
<property name="geometry">
<rect>
<x>490</x>
<y>60</y>
<width>121</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>10</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0.0511364, y1:0.5, x2:0.938, y2:0.534091, stop:0 rgba(231, 163, 4, 255), stop:1 rgba(238, 211, 4, 255));
color: white;
border-radius: 10;
padding: 6;
border-style: outset;
border-width: 1;
border-top-color: rgb(135, 135, 135);
border-left-color: rgb(135, 135, 135);
border-right-color: rgb(0, 0, 0);
border-bottom-color: rgb(0, 0, 0);
}
QPushButton:pressed {
border-style: outset;
border-top-color: rgb(0, 0, 0);
border-left-color: rgb(0, 0, 0);
border-right-color: rgb(135, 135, 135);
border-bottom-color: rgb(135, 135, 135);
}</string>
</property>
<property name="text">
<string>SEARCH</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="clan_shield">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>120</width>
<height>120</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="clan_name">
<property name="geometry">
<rect>
<x>140</x>
<y>110</y>
<width>221</width>
<height>61</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QTextEdit" name="clan_description">
<property name="geometry">
<rect>
<x>140</x>
<y>155</y>
<width>471</width>
<height>65</height>
</rect>
</property>
<property name="font">
<font>
<family>Calibri</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(222, 222, 222);
border-radius: 7;
border: 1px solid black</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="no_clan">
<property name="geometry">
<rect>
<x>20</x>
<y>100</y>
<width>371</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>Calibri</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: red</string>
</property>
<property name="text">
<string>No clan found! Please try again.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QPushButton" name="confirm_clan">
<property name="geometry">
<rect>
<x>20</x>
<y>230</y>
<width>591</width>
<height>61</height>
</rect>
</property>
<property name="font">
<font>
<family>Supercell-Magic</family>
<pointsize>14</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0.125, y1:0.466, x2:0.938, y2:0.472, stop:0 rgba(0, 144, 24, 255), stop:1 rgba(124, 255, 38, 255));
color: white;
border-radius: 10;
padding: 6;
border-style: outset;
border-width: 1;
border-top-color: rgb(135, 135, 135);
border-left-color: rgb(135, 135, 135);
border-right-color: rgb(0, 0, 0);
border-bottom-color: rgb(0, 0, 0);
}
QPushButton:pressed {
border-style: outset;
border-top-color: rgb(0, 0, 0);
border-left-color: rgb(0, 0, 0);
border-right-color: rgb(135, 135, 135);
border-bottom-color: rgb(135, 135, 135);
}</string>
</property>
<property name="text">
<string>CONFIRM SELECTION</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1070</width>
<height>21</height>
</rect>
</property>
</widget>
</widget>
<resources>
<include location="Game Graphics/source.qrc"/>
</resources>
<connections/>
</ui>
To clarify, I want to make it so hovering over clan_shield_0 changes the background colour of frame_0. I know that hovering over frame_0 already changes its background colour, but I need clan_shield_0 to change frame_0's background colour too.

Qt Designer - Why does number get pushed to the left when LCD Number is resized?

I am building a very basic calculator demo application in Qt Designer (Qt Version: 5.15.2). I notice that when I resize the window, the digits in the LCD Number display get pushed to the left. Why does this occur?
Before resize:
After resize:
I put one horizontalSpacer The out put is like this , Try this :
<?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>473</width>
<height>274</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QPushButton" name="radicalButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>√</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="mMinusButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>M-</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="equalsButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>=</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="offButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>OFF</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="timesButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>×</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="button9">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>9</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="acButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>AC</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="percentButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>%</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="button2">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>2</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="cButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>C</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QPushButton" name="button3">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>3</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="divideButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>÷</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="dotButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>.</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="button4">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>4</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="button0">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="button1">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="mrcButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>MRC</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="button5">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>5</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="mPlusButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>M+</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="button7">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>7</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="button8">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>8</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="button6">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>6</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="minusButton">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="4" column="4" rowspan="2">
<widget class="QPushButton" name="plusButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLCDNumber" name="lcdNumber">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>ForbiddenCursor</cursorShape>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="smallDecimalPoint">
<bool>false</bool>
</property>
<property name="digitCount">
<number>1</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0">
<double>0.000000000000000</double>
</property>
<property name="intValue" stdset="0">
<number>0</number>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

QT5 styling QPushButton to remove space around it

I creating simple sliding menu in Qt5 Qt Widgets Application.
All seems work fine and now my form look like this:
When i press button submenu showed and other element slides down.
Here code of the form:
<?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>695</width>
<height>388</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="centralwidget">
<property name="styleSheet">
<string notr="true">QWidget#centralwidget {
border-top: 1px solid gray;
}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</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>
<widget class="QWidget" name="menuContainerBox" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>101</width>
<height>0</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QWidget#menuContainerBox{
border-right: 1px solid gray;
}
QWidget#menuBoxWidget QPushButton
{
border: 1px solid gray;
border-bottom: none;
border-left: none;
border-right: none;
padding: 3 20px;
text-align: left;
}
QWidget#menuBoxWidget QWidget QPushButton
{
padding: 3 10px;
text-align: right;
}
QWidget#menuBoxWidget QWidget QPushButton:hover
{
background-color: rgb(168, 168, 168);
}
QWidget#menuBoxWidget QPushButton:hover
{
background-color: rgb(168, 168, 168);
}
QWidget#menuBoxWidget {
border-bottom: 1px solid gray;
}</string>
</property>
<layout class="QVBoxLayout" name="menuContainer">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="QWidget" name="menuBoxWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="menuBox">
<property name="spacing">
<number>0</number>
</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>
<widget class="QPushButton" name="menu1">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Menu1</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="subMenuBox1" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0">
<property name="spacing">
<number>0</number>
</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>
<widget class="QPushButton" name="pushButton_5">
<property name="text">
<string>Submenu1_1</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Submenu1_2</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="menu2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Menu2</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="subMenuBox2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>0</number>
</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>
<widget class="QPushButton" name="pushButton_11">
<property name="text">
<string>Submenu2_1</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_7">
<property name="text">
<string>Submenu2_2</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_8">
<property name="text">
<string>Submenu2_3</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="menu3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Menu3</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="subMenuBox3" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>0</number>
</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>
<widget class="QPushButton" name="pushButton_9">
<property name="text">
<string>Submenu3_1</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="LogoBtn">
<property name="styleSheet">
<string notr="true">border: none;
font-width: bold;</string>
</property>
<property name="text">
<string>LOGO</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>695</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuAbout">
<property name="title">
<string>About</string>
</property>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuAbout"/>
</widget>
<action name="actionAbout">
<property name="text">
<string>About...</string>
</property>
</action>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
and here program code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QDebug>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->subMenuBox1->hide();
ui->subMenuBox2->hide();
ui->subMenuBox3->hide();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_menu1_clicked()
{
qInfo() << "Clicked!";
if (ui->subMenuBox1->isHidden()){
ui->subMenuBox1->show();
ui->subMenuBox2->hide();
ui->subMenuBox3->hide();
}
}
void MainWindow::on_menu2_clicked()
{
qInfo() << "Clicked!";
if (ui->subMenuBox2->isHidden()){
ui->subMenuBox2->show();
ui->subMenuBox1->hide();
ui->subMenuBox3->hide();
}
}
void MainWindow::on_menu3_clicked()
{
qInfo() << "Clicked!";
if (ui->subMenuBox3->isHidden()){
ui->subMenuBox3->show();
ui->subMenuBox2->hide();
ui->subMenuBox1->hide();
}
}
it simple and works just fine.
But now i need to style it, by removing all spaces between buttons and align buttons text to left and submenu buttons text little to right.
I try set padding:0 for subMenuBox1 but it only affect buttons height.
Also i need add line on right side of menuBoxWidget so it divide menu from other screen.
How to style it, so menu looks nice?
UPDATE 1:
I updated form code with styles added.
Ok, i figure out how it works!
Here styles:
QWidget#menuContainerBox{
border-right: 1px solid gray;
}
QWidget#menuBoxWidget QPushButton
{
border: 1px solid gray;
border-bottom: none;
border-left: none;
border-right: none;
padding: 3 20px;
text-align: left;
}
QWidget#menuBoxWidget QWidget QPushButton
{
padding: 3 10px;
text-align: right;
}
QWidget#menuBoxWidget QWidget QPushButton:hover
{
background-color: rgb(168, 168, 168);
}
QWidget#menuBoxWidget QPushButton:hover
{
background-color: rgb(168, 168, 168);
}
QWidget#menuBoxWidget {
border-bottom: 1px solid gray;
}
And now it looks like, it very basic, but it works and looks like i wanted!

How to set the distance between the axis of QCustomPlot and the original edge of the QWidget to 0?

I promoted a QWidget to QCustomPlot and set the number of coordinates not to display. I add 4 QPushButtons and a QCustomplot to a gridlayout like image 1
What I want is the yaxis of QCustomPlot to be aligned with the QPushButton like image 2
However, there is a distance between the axis and the original edge of the QWidget like image 3
How do I set the axis of QCustomPlot to the boundary of the qwidget to 0?
Besides,I want to set the style of xaxis and yaxis like image 4
The code of mainwindow.ui:
<?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>399</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QWidget" name="gridWidget" native="true">
<property name="geometry">
<rect>
<x>110</x>
<y>0</y>
<width>181</width>
<height>251</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget{border:2px solid rgb(0, 100, 238);}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_3">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QCustomPlot" name="widget" native="true"/>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>17</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QCustomPlot</class>
<extends>QWidget</extends>
<header location="global">qcustomplot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Is there any easy way to realize this ? Thanks for any Suggestions!

Difference Between Class Reference And Class Instance

Given that both of these calls to getQualifiedClassName return the same thing (mx:Label), how would one go about programatically differentiating between an instance of a class and a reference to the class...
var lab1:Label=new Label();
var lab2:Class=Label;
var qcn1:String=getQualifiedClassName(lab1);
var qcn2:String=getQualifiedClassName(lab2);
In other words, how could I know that lab1 is of type Label, while lab2 is type "Class".
typeof() simply returns "object" for both... getQualifiedClassName returns "mx.controls::Label" for both...
What do I use?
The is operator:
>>> lab1 is Label
true
>>> lab1 is Class
false
>>> lab2 is Label
false
>>> lab2 is Class
true
Also (although this should be trivially true) lab2 == Label.
trace( Sprite is Class ); // true
trace( new Sprite() is Class ); // false
To test things in more details in the future, you can always use
import flash.utils.describeType;
trace(describeType(new Label()));
trace(describeType(Label));
This will give you 2 XML outputs. Here you will be able to clearly see the difference.
I have provided 2 here for you for the Point class, since point is a relatively simple class compared to DisplayObjects and any class that extends off them.
Instance.
<type name="flash.geom::Point" base="Object" isDynamic="false" isFinal="false" isStatic="false">
<extendsClass type="Object"/>
<constructor>
<parameter index="1" type="Number" optional="true"/>
<parameter index="2" type="Number" optional="true"/>
</constructor>
<variable name="x" type="Number"/>
<variable name="y" type="Number"/>
<accessor name="length" access="readonly" type="Number" declaredBy="flash.geom::Point"/>
<method name="clone" declaredBy="flash.geom::Point" returnType="flash.geom::Point"/>
<method name="add" declaredBy="flash.geom::Point" returnType="flash.geom::Point">
<parameter index="1" type="flash.geom::Point" optional="false"/>
</method>
<method name="equals" declaredBy="flash.geom::Point" returnType="Boolean">
<parameter index="1" type="flash.geom::Point" optional="false"/>
</method>
<method name="subtract" declaredBy="flash.geom::Point" returnType="flash.geom::Point">
<parameter index="1" type="flash.geom::Point" optional="false"/>
</method>
<method name="normalize" declaredBy="flash.geom::Point" returnType="void">
<parameter index="1" type="Number" optional="false"/>
</method>
<method name="offset" declaredBy="flash.geom::Point" returnType="void">
<parameter index="1" type="Number" optional="false"/>
<parameter index="2" type="Number" optional="false"/>
</method>
<method name="toString" declaredBy="flash.geom::Point" returnType="String"/>
</type>
Class
<type name="flash.geom::Point" base="Class" isDynamic="true" isFinal="true" isStatic="true">
<extendsClass type="Class"/>
<extendsClass type="Object"/>
<accessor name="prototype" access="readonly" type="*" declaredBy="Class"/>
<method name="polar" declaredBy="flash.geom::Point" returnType="flash.geom::Point">
<parameter index="1" type="Number" optional="false"/>
<parameter index="2" type="Number" optional="false"/>
</method>
<method name="interpolate" declaredBy="flash.geom::Point" returnType="flash.geom::Point">
<parameter index="1" type="flash.geom::Point" optional="false"/>
<parameter index="2" type="flash.geom::Point" optional="false"/>
<parameter index="3" type="Number" optional="false"/>
</method>
<method name="distance" declaredBy="flash.geom::Point" returnType="Number">
<parameter index="1" type="flash.geom::Point" optional="false"/>
<parameter index="2" type="flash.geom::Point" optional="false"/>
</method>
<factory type="flash.geom::Point">
<extendsClass type="Object"/>
<constructor>
<parameter index="1" type="Number" optional="true"/>
<parameter index="2" type="Number" optional="true"/>
</constructor>
<variable name="x" type="Number"/>
<variable name="y" type="Number"/>
<accessor name="length" access="readonly" type="Number" declaredBy="flash.geom::Point"/>
<method name="clone" declaredBy="flash.geom::Point" returnType="flash.geom::Point"/>
<method name="add" declaredBy="flash.geom::Point" returnType="flash.geom::Point">
<parameter index="1" type="flash.geom::Point" optional="false"/>
</method>
<method name="equals" declaredBy="flash.geom::Point" returnType="Boolean">
<parameter index="1" type="flash.geom::Point" optional="false"/>
</method>
<method name="subtract" declaredBy="flash.geom::Point" returnType="flash.geom::Point">
<parameter index="1" type="flash.geom::Point" optional="false"/>
</method>
<method name="normalize" declaredBy="flash.geom::Point" returnType="void">
<parameter index="1" type="Number" optional="false"/>
</method>
<method name="offset" declaredBy="flash.geom::Point" returnType="void">
<parameter index="1" type="Number" optional="false"/>
<parameter index="2" type="Number" optional="false"/>
</method>
<method name="toString" declaredBy="flash.geom::Point" returnType="String"/>
</factory>
</type>
The Main differences being base="Object" and base="Class" and also the Class one has a <factory /> node. There are obviosuly more differences, but those are usually the parts I concentrate on the most.

Resources