Style Sheet Example▲
Sélectionnez
&
lt;ui version=
"4.0"
&
gt;
&
lt;class
&
gt;MainWindow&
lt;/
class
&
gt;
&
lt;widget class
=
"QMainWindow"
name=
"MainWindow"
&
gt;
&
lt;property name=
"geometry"
&
gt;
&
lt;rect&
gt;
&
lt;x&
gt;0
&
lt;/
x&
gt;
&
lt;y&
gt;0
&
lt;/
y&
gt;
&
lt;width&
gt;400
&
lt;/
width&
gt;
&
lt;height&
gt;413
&
lt;/
height&
gt;
&
lt;/
rect&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"windowTitle"
&
gt;
&
lt;string&
gt;Style Sheet&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;widget class
=
"QWidget"
name=
"centralwidget"
&
gt;
&
lt;layout class
=
"QVBoxLayout"
&
gt;
&
lt;property name=
"margin"
&
gt;
&
lt;number&
gt;9
&
lt;/
number&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"spacing"
&
gt;
&
lt;number&
gt;6
&
lt;/
number&
gt;
&
lt;/
property&
gt;
&
lt;item&
gt;
&
lt;widget class
=
"QFrame"
name=
"mainFrame"
&
gt;
&
lt;property name=
"frameShape"
&
gt;
&
lt;enum
&
gt;QFrame::
StyledPanel&
lt;/
enum
&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"frameShadow"
&
gt;
&
lt;enum
&
gt;QFrame::
Raised&
lt;/
enum
&
gt;
&
lt;/
property&
gt;
&
lt;layout class
=
"QGridLayout"
&
gt;
&
lt;property name=
"margin"
&
gt;
&
lt;number&
gt;9
&
lt;/
number&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"spacing"
&
gt;
&
lt;number&
gt;6
&
lt;/
number&
gt;
&
lt;/
property&
gt;
&
lt;item row=
"6"
column=
"0"
colspan=
"5"
&
gt;
&
lt;widget class
=
"QCheckBox"
name=
"agreeCheckBox"
&
gt;
&
lt;property name=
"toolTip"
&
gt;
&
lt;string&
gt;Please read the LICENSE file before checking&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;I accept the terms and
&
amp;amp;conditions&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"5"
column=
"0"
&
gt;
&
lt;widget class
=
"QLabel"
name=
"label"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Profession:&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"alignment"
&
gt;
&
lt;set&
gt;Qt::
AlignRight|
Qt::
AlignTop|
Qt::
AlignTrailing&
lt;/
set&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"buddy"
&
gt;
&
lt;cstring&
gt;professionList&
lt;/
cstring&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"0"
column=
"0"
&
gt;
&
lt;widget class
=
"QLabel"
name=
"nameLabel"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;&
amp;amp;Name:&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"alignment"
&
gt;
&
lt;set&
gt;Qt::
AlignRight|
Qt::
AlignTrailing|
Qt::
AlignVCenter&
lt;/
set&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"buddy"
&
gt;
&
lt;cstring&
gt;nameCombo&
lt;/
cstring&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"1"
column=
"1"
&
gt;
&
lt;widget class
=
"QRadioButton"
name=
"maleRadioButton"
&
gt;
&
lt;property name=
"toolTip"
&
gt;
&
lt;string&
gt;Check this
if
you are male&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;&
amp;amp;Male&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"3"
column=
"0"
&
gt;
&
lt;widget class
=
"QLabel"
name=
"passwordLabel"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;&
amp;amp;Password:&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"alignment"
&
gt;
&
lt;set&
gt;Qt::
AlignRight|
Qt::
AlignTrailing|
Qt::
AlignVCenter&
lt;/
set&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"buddy"
&
gt;
&
lt;cstring&
gt;passwordEdit&
lt;/
cstring&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"4"
column=
"1"
colspan=
"4"
&
gt;
&
lt;widget class
=
"QComboBox"
name=
"countryCombo"
&
gt;
&
lt;property name=
"toolTip"
&
gt;
&
lt;string&
gt;Specify country of origin&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"statusTip"
&
gt;
&
lt;string&
gt;Specify country of origin&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"currentIndex"
&
gt;
&
lt;number&
gt;6
&
lt;/
number&
gt;
&
lt;/
property&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Egypt&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;France&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Germany&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;India&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Italy&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Norway&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Pakistan&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"2"
column=
"0"
&
gt;
&
lt;widget class
=
"QLabel"
name=
"ageLabel"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;&
amp;amp;Age:&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"alignment"
&
gt;
&
lt;set&
gt;Qt::
AlignRight|
Qt::
AlignTrailing|
Qt::
AlignVCenter&
lt;/
set&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"buddy"
&
gt;
&
lt;cstring&
gt;ageSpinBox&
lt;/
cstring&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"4"
column=
"0"
&
gt;
&
lt;widget class
=
"QLabel"
name=
"countryLabel"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Country:&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"alignment"
&
gt;
&
lt;set&
gt;Qt::
AlignRight|
Qt::
AlignTrailing|
Qt::
AlignVCenter&
lt;/
set&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"buddy"
&
gt;
&
lt;cstring&
gt;countryCombo&
lt;/
cstring&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"1"
column=
"0"
&
gt;
&
lt;widget class
=
"QLabel"
name=
"genderLabel"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Gender:&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"alignment"
&
gt;
&
lt;set&
gt;Qt::
AlignRight|
Qt::
AlignTrailing|
Qt::
AlignVCenter&
lt;/
set&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"3"
column=
"1"
colspan=
"4"
&
gt;
&
lt;widget class
=
"QLineEdit"
name=
"passwordEdit"
&
gt;
&
lt;property name=
"toolTip"
&
gt;
&
lt;string&
gt;Specify your password&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"statusTip"
&
gt;
&
lt;string&
gt;Specify your password&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Password&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"echoMode"
&
gt;
&
lt;enum
&
gt;QLineEdit::
Password&
lt;/
enum
&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"1"
column=
"2"
colspan=
"2"
&
gt;
&
lt;widget class
=
"QRadioButton"
name=
"femaleRadioButton"
&
gt;
&
lt;property name=
"toolTip"
&
gt;
&
lt;string&
gt;Check this
if
you are female&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;&
amp;amp;Female&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"2"
column=
"1"
colspan=
"2"
&
gt;
&
lt;widget class
=
"QSpinBox"
name=
"ageSpinBox"
&
gt;
&
lt;property name=
"toolTip"
&
gt;
&
lt;string&
gt;Specify your age&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"statusTip"
&
gt;
&
lt;string&
gt;Specify your age&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"minimum"
&
gt;
&
lt;number&
gt;12
&
lt;/
number&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"value"
&
gt;
&
lt;number&
gt;22
&
lt;/
number&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"0"
column=
"1"
colspan=
"4"
&
gt;
&
lt;widget class
=
"QComboBox"
name=
"nameCombo"
&
gt;
&
lt;property name=
"toolTip"
&
gt;
&
lt;string&
gt;Specify your name&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"editable"
&
gt;
&
lt;bool
&
gt;true
&
lt;/
bool
&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"1"
column=
"4"
&
gt;
&
lt;spacer&
gt;
&
lt;property name=
"orientation"
&
gt;
&
lt;enum
&
gt;Qt::
Horizontal&
lt;/
enum
&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"sizeHint"
&
gt;
&
lt;size&
gt;
&
lt;width&
gt;40
&
lt;/
width&
gt;
&
lt;height&
gt;20
&
lt;/
height&
gt;
&
lt;/
size&
gt;
&
lt;/
property&
gt;
&
lt;/
spacer&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"2"
column=
"3"
colspan=
"2"
&
gt;
&
lt;spacer&
gt;
&
lt;property name=
"orientation"
&
gt;
&
lt;enum
&
gt;Qt::
Horizontal&
lt;/
enum
&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"sizeHint"
&
gt;
&
lt;size&
gt;
&
lt;width&
gt;61
&
lt;/
width&
gt;
&
lt;height&
gt;20
&
lt;/
height&
gt;
&
lt;/
size&
gt;
&
lt;/
property&
gt;
&
lt;/
spacer&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"7"
column=
"3"
colspan=
"2"
&
gt;
&
lt;widget class
=
"QDialogButtonBox"
name=
"buttonBox"
&
gt;
&
lt;property name=
"orientation"
&
gt;
&
lt;enum
&
gt;Qt::
Horizontal&
lt;/
enum
&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"standardButtons"
&
gt;
&
lt;set&
gt;QDialogButtonBox::
Cancel|
QDialogButtonBox::
NoButton|
QDialogButtonBox::
Ok&
lt;/
set&
gt;
&
lt;/
property&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;item row=
"5"
column=
"1"
colspan=
"4"
&
gt;
&
lt;widget class
=
"QListWidget"
name=
"professionList"
&
gt;
&
lt;property name=
"toolTip"
&
gt;
&
lt;string&
gt;Select your profession&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"statusTip"
&
gt;
&
lt;string&
gt;Specify your name here&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"whatsThis"
&
gt;
&
lt;string&
gt;Specify your name here&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;property name=
"currentRow"
&
gt;
&
lt;number&
gt;0
&
lt;/
number&
gt;
&
lt;/
property&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Developer&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Student&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;item&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Fisherman&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
item&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;/
layout&
gt;
&
lt;/
widget&
gt;
&
lt;/
item&
gt;
&
lt;/
layout&
gt;
&
lt;/
widget&
gt;
&
lt;widget class
=
"QMenuBar"
name=
"menubar"
&
gt;
&
lt;property name=
"geometry"
&
gt;
&
lt;rect&
gt;
&
lt;x&
gt;0
&
lt;/
x&
gt;
&
lt;y&
gt;0
&
lt;/
y&
gt;
&
lt;width&
gt;400
&
lt;/
width&
gt;
&
lt;height&
gt;29
&
lt;/
height&
gt;
&
lt;/
rect&
gt;
&
lt;/
property&
gt;
&
lt;widget class
=
"QMenu"
name=
"menu_File"
&
gt;
&
lt;property name=
"title"
&
gt;
&
lt;string&
gt;&
amp;amp;File&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;addaction name=
"editStyleAction"
/&
gt;
&
lt;addaction name=
"separator"
/&
gt;
&
lt;addaction name=
"exitAction"
/&
gt;
&
lt;/
widget&
gt;
&
lt;widget class
=
"QMenu"
name=
"menu_Help"
&
gt;
&
lt;property name=
"title"
&
gt;
&
lt;string&
gt;&
amp;amp;Help&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;addaction name=
"aboutAction"
/&
gt;
&
lt;addaction name=
"aboutQtAction"
/&
gt;
&
lt;/
widget&
gt;
&
lt;addaction name=
"menu_File"
/&
gt;
&
lt;addaction name=
"menu_Help"
/&
gt;
&
lt;/
widget&
gt;
&
lt;widget class
=
"QStatusBar"
name=
"statusbar"
/&
gt;
&
lt;action name=
"exitAction"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;&
amp;amp;Exit&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
action&
gt;
&
lt;action name=
"aboutQtAction"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;About Qt&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
action&
gt;
&
lt;action name=
"editStyleAction"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;Edit &
amp;amp;Style...&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
action&
gt;
&
lt;action name=
"aboutAction"
&
gt;
&
lt;property name=
"text"
&
gt;
&
lt;string&
gt;About&
lt;/
string&
gt;
&
lt;/
property&
gt;
&
lt;/
action&
gt;
&
lt;/
widget&
gt;
&
lt;resources/&
gt;
&
lt;connections/&
gt;
&
lt;/
ui&
gt;