diff options
author | axis <qt-info@nokia.com> | 2009-04-24 11:34:15 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-04-24 11:34:15 (GMT) |
commit | 8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (patch) | |
tree | a17e1a767a89542ab59907462206d7dcf2e504b2 /examples/widgets/stylesheet | |
download | Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.zip Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.gz Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.bz2 |
Long live Qt for S60!
Diffstat (limited to 'examples/widgets/stylesheet')
44 files changed, 2030 insertions, 0 deletions
diff --git a/examples/widgets/stylesheet/images/checkbox_checked.png b/examples/widgets/stylesheet/images/checkbox_checked.png Binary files differnew file mode 100644 index 0000000..cbf06f6 --- /dev/null +++ b/examples/widgets/stylesheet/images/checkbox_checked.png diff --git a/examples/widgets/stylesheet/images/checkbox_checked_hover.png b/examples/widgets/stylesheet/images/checkbox_checked_hover.png Binary files differnew file mode 100644 index 0000000..fb4d4d3 --- /dev/null +++ b/examples/widgets/stylesheet/images/checkbox_checked_hover.png diff --git a/examples/widgets/stylesheet/images/checkbox_checked_pressed.png b/examples/widgets/stylesheet/images/checkbox_checked_pressed.png Binary files differnew file mode 100644 index 0000000..852fcc0 --- /dev/null +++ b/examples/widgets/stylesheet/images/checkbox_checked_pressed.png diff --git a/examples/widgets/stylesheet/images/checkbox_unchecked.png b/examples/widgets/stylesheet/images/checkbox_unchecked.png Binary files differnew file mode 100644 index 0000000..5f54655 --- /dev/null +++ b/examples/widgets/stylesheet/images/checkbox_unchecked.png diff --git a/examples/widgets/stylesheet/images/checkbox_unchecked_hover.png b/examples/widgets/stylesheet/images/checkbox_unchecked_hover.png Binary files differnew file mode 100644 index 0000000..6873644 --- /dev/null +++ b/examples/widgets/stylesheet/images/checkbox_unchecked_hover.png diff --git a/examples/widgets/stylesheet/images/checkbox_unchecked_pressed.png b/examples/widgets/stylesheet/images/checkbox_unchecked_pressed.png Binary files differnew file mode 100644 index 0000000..6a768c4 --- /dev/null +++ b/examples/widgets/stylesheet/images/checkbox_unchecked_pressed.png diff --git a/examples/widgets/stylesheet/images/down_arrow.png b/examples/widgets/stylesheet/images/down_arrow.png Binary files differnew file mode 100644 index 0000000..85004ae --- /dev/null +++ b/examples/widgets/stylesheet/images/down_arrow.png diff --git a/examples/widgets/stylesheet/images/down_arrow_disabled.png b/examples/widgets/stylesheet/images/down_arrow_disabled.png Binary files differnew file mode 100644 index 0000000..d9eefed --- /dev/null +++ b/examples/widgets/stylesheet/images/down_arrow_disabled.png diff --git a/examples/widgets/stylesheet/images/frame.png b/examples/widgets/stylesheet/images/frame.png Binary files differnew file mode 100644 index 0000000..05a6005 --- /dev/null +++ b/examples/widgets/stylesheet/images/frame.png diff --git a/examples/widgets/stylesheet/images/pagefold.png b/examples/widgets/stylesheet/images/pagefold.png Binary files differnew file mode 100644 index 0000000..69be8f2 --- /dev/null +++ b/examples/widgets/stylesheet/images/pagefold.png diff --git a/examples/widgets/stylesheet/images/pushbutton.png b/examples/widgets/stylesheet/images/pushbutton.png Binary files differnew file mode 100644 index 0000000..c7529ba --- /dev/null +++ b/examples/widgets/stylesheet/images/pushbutton.png diff --git a/examples/widgets/stylesheet/images/pushbutton_hover.png b/examples/widgets/stylesheet/images/pushbutton_hover.png Binary files differnew file mode 100644 index 0000000..af0ef9d --- /dev/null +++ b/examples/widgets/stylesheet/images/pushbutton_hover.png diff --git a/examples/widgets/stylesheet/images/pushbutton_pressed.png b/examples/widgets/stylesheet/images/pushbutton_pressed.png Binary files differnew file mode 100644 index 0000000..f7381f7 --- /dev/null +++ b/examples/widgets/stylesheet/images/pushbutton_pressed.png diff --git a/examples/widgets/stylesheet/images/radiobutton_checked.png b/examples/widgets/stylesheet/images/radiobutton_checked.png Binary files differnew file mode 100644 index 0000000..8ab9157 --- /dev/null +++ b/examples/widgets/stylesheet/images/radiobutton_checked.png diff --git a/examples/widgets/stylesheet/images/radiobutton_checked_hover.png b/examples/widgets/stylesheet/images/radiobutton_checked_hover.png Binary files differnew file mode 100644 index 0000000..d68cb00 --- /dev/null +++ b/examples/widgets/stylesheet/images/radiobutton_checked_hover.png diff --git a/examples/widgets/stylesheet/images/radiobutton_checked_pressed.png b/examples/widgets/stylesheet/images/radiobutton_checked_pressed.png Binary files differnew file mode 100644 index 0000000..e3cd5a5 --- /dev/null +++ b/examples/widgets/stylesheet/images/radiobutton_checked_pressed.png diff --git a/examples/widgets/stylesheet/images/radiobutton_unchecked.png b/examples/widgets/stylesheet/images/radiobutton_unchecked.png Binary files differnew file mode 100644 index 0000000..321a9a1 --- /dev/null +++ b/examples/widgets/stylesheet/images/radiobutton_unchecked.png diff --git a/examples/widgets/stylesheet/images/radiobutton_unchecked_hover.png b/examples/widgets/stylesheet/images/radiobutton_unchecked_hover.png Binary files differnew file mode 100644 index 0000000..666a3b0 --- /dev/null +++ b/examples/widgets/stylesheet/images/radiobutton_unchecked_hover.png diff --git a/examples/widgets/stylesheet/images/radiobutton_unchecked_pressed.png b/examples/widgets/stylesheet/images/radiobutton_unchecked_pressed.png Binary files differnew file mode 100644 index 0000000..c4b0567 --- /dev/null +++ b/examples/widgets/stylesheet/images/radiobutton_unchecked_pressed.png diff --git a/examples/widgets/stylesheet/images/sizegrip.png b/examples/widgets/stylesheet/images/sizegrip.png Binary files differnew file mode 100644 index 0000000..350583a --- /dev/null +++ b/examples/widgets/stylesheet/images/sizegrip.png diff --git a/examples/widgets/stylesheet/images/spindown.png b/examples/widgets/stylesheet/images/spindown.png Binary files differnew file mode 100644 index 0000000..7ff3c64 --- /dev/null +++ b/examples/widgets/stylesheet/images/spindown.png diff --git a/examples/widgets/stylesheet/images/spindown_hover.png b/examples/widgets/stylesheet/images/spindown_hover.png Binary files differnew file mode 100644 index 0000000..1486c4d --- /dev/null +++ b/examples/widgets/stylesheet/images/spindown_hover.png diff --git a/examples/widgets/stylesheet/images/spindown_off.png b/examples/widgets/stylesheet/images/spindown_off.png Binary files differnew file mode 100644 index 0000000..a90ab3f --- /dev/null +++ b/examples/widgets/stylesheet/images/spindown_off.png diff --git a/examples/widgets/stylesheet/images/spindown_pressed.png b/examples/widgets/stylesheet/images/spindown_pressed.png Binary files differnew file mode 100644 index 0000000..f6271cb --- /dev/null +++ b/examples/widgets/stylesheet/images/spindown_pressed.png diff --git a/examples/widgets/stylesheet/images/spinup.png b/examples/widgets/stylesheet/images/spinup.png Binary files differnew file mode 100644 index 0000000..1069dd0 --- /dev/null +++ b/examples/widgets/stylesheet/images/spinup.png diff --git a/examples/widgets/stylesheet/images/spinup_hover.png b/examples/widgets/stylesheet/images/spinup_hover.png Binary files differnew file mode 100644 index 0000000..884c8d7 --- /dev/null +++ b/examples/widgets/stylesheet/images/spinup_hover.png diff --git a/examples/widgets/stylesheet/images/spinup_off.png b/examples/widgets/stylesheet/images/spinup_off.png Binary files differnew file mode 100644 index 0000000..02dad1f --- /dev/null +++ b/examples/widgets/stylesheet/images/spinup_off.png diff --git a/examples/widgets/stylesheet/images/spinup_pressed.png b/examples/widgets/stylesheet/images/spinup_pressed.png Binary files differnew file mode 100644 index 0000000..b1843e2 --- /dev/null +++ b/examples/widgets/stylesheet/images/spinup_pressed.png diff --git a/examples/widgets/stylesheet/images/up_arrow.png b/examples/widgets/stylesheet/images/up_arrow.png Binary files differnew file mode 100644 index 0000000..e7f7ddb --- /dev/null +++ b/examples/widgets/stylesheet/images/up_arrow.png diff --git a/examples/widgets/stylesheet/images/up_arrow_disabled.png b/examples/widgets/stylesheet/images/up_arrow_disabled.png Binary files differnew file mode 100644 index 0000000..4d2c277 --- /dev/null +++ b/examples/widgets/stylesheet/images/up_arrow_disabled.png diff --git a/examples/widgets/stylesheet/layouts/default.ui b/examples/widgets/stylesheet/layouts/default.ui new file mode 100644 index 0000000..431a409 --- /dev/null +++ b/examples/widgets/stylesheet/layouts/default.ui @@ -0,0 +1,329 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>388</width> + <height>413</height> + </rect> + </property> + <property name="windowTitle" > + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QGridLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="nameLabel" > + <property name="text" > + <string>&Name:</string> + </property> + <property name="buddy" > + <cstring>nameCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1" colspan="3" > + <widget class="QComboBox" name="nameCombo" > + <property name="toolTip" > + <string>Specify your name</string> + </property> + <property name="editable" > + <bool>true</bool> + </property> + <property name="currentIndex" > + <number>-1</number> + </property> + <item> + <property name="text" > + <string>Girish</string> + </property> + </item> + <item> + <property name="text" > + <string>Jasmin</string> + </property> + </item> + <item> + <property name="text" > + <string>Simon</string> + </property> + </item> + <item> + <property name="text" > + <string>Zack</string> + </property> + </item> + </widget> + </item> + <item row="1" column="3" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2" > + <widget class="QRadioButton" name="femaleRadioButton" > + <property name="toolTip" > + <string>Check this if you are female</string> + </property> + <property name="text" > + <string>&Female</string> + </property> + </widget> + </item> + <item row="6" column="0" colspan="4" > + <widget class="QCheckBox" name="agreeCheckBox" > + <property name="toolTip" > + <string>Please read the license before checking this</string> + </property> + <property name="text" > + <string>I &accept the terms and conditions</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QRadioButton" name="maleRadioButton" > + <property name="toolTip" > + <string>Check this if you are male</string> + </property> + <property name="text" > + <string>&Male</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="genderLabel" > + <property name="text" > + <string>Gender:</string> + </property> + </widget> + </item> + <item row="2" column="1" colspan="3" > + <widget class="QSpinBox" name="ageSpinBox" > + <property name="toolTip" > + <string>Specify your age</string> + </property> + <property name="statusTip" > + <string>Specify your age here</string> + </property> + <property name="minimum" > + <number>12</number> + </property> + <property name="value" > + <number>22</number> + </property> + </widget> + </item> + <item row="7" column="2" colspan="2" > + <widget class="QDialogButtonBox" name="buttonBox" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="ageLabel" > + <property name="text" > + <string>&Age:</string> + </property> + <property name="buddy" > + <cstring>ageSpinBox</cstring> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="passwordLabel" > + <property name="text" > + <string>&Password:</string> + </property> + <property name="buddy" > + <cstring>passwordEdit</cstring> + </property> + </widget> + </item> + <item row="3" column="1" colspan="3" > + <widget class="QLineEdit" name="passwordEdit" > + <property name="toolTip" > + <string>Specify your password</string> + </property> + <property name="statusTip" > + <string>Specify your password here</string> + </property> + <property name="text" > + <string>Password</string> + </property> + <property name="echoMode" > + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + <item row="5" column="0" > + <widget class="QLabel" name="label" > + <property name="text" > + <string>Profession</string> + </property> + <property name="buddy" > + <cstring>professionList</cstring> + </property> + </widget> + </item> + <item row="4" column="0" > + <widget class="QLabel" name="countryLabel" > + <property name="text" > + <string>&Country</string> + </property> + <property name="buddy" > + <cstring>professionList</cstring> + </property> + </widget> + </item> + <item row="5" column="1" colspan="3" > + <widget class="QListWidget" name="professionList" > + <property name="toolTip" > + <string>Select your profession</string> + </property> + <property name="statusTip" > + <string>Select your profession</string> + </property> + <property name="whatsThis" > + <string>Select your profession</string> + </property> + <property name="currentRow" > + <number>1</number> + </property> + <item> + <property name="text" > + <string>Developer</string> + </property> + </item> + <item> + <property name="text" > + <string>Student</string> + </property> + </item> + <item> + <property name="text" > + <string>Fisherman</string> + </property> + </item> + </widget> + </item> + <item row="4" column="1" colspan="3" > + <widget class="QComboBox" name="countryCombo" > + <property name="toolTip" > + <string>Specify your country</string> + </property> + <property name="statusTip" > + <string>Specify your country here</string> + </property> + <property name="currentIndex" > + <number>2</number> + </property> + <item> + <property name="text" > + <string>Germany</string> + </property> + </item> + <item> + <property name="text" > + <string>India</string> + </property> + </item> + <item> + <property name="text" > + <string>Norway</string> + </property> + </item> + <item> + <property name="text" > + <string>United States Of America</string> + </property> + </item> + <item> + <property name="text" > + <string>United Kingdom</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>388</width> + <height>21</height> + </rect> + </property> + <widget class="QMenu" name="menu_File" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="editStyleAction" /> + <addaction name="separator" /> + <addaction name="exitAction" /> + </widget> + <widget class="QMenu" name="menu_Help" > + <property name="title" > + <string>&Help</string> + </property> + <addaction name="aboutAction" /> + <addaction name="separator" /> + <addaction name="aboutQtAction" /> + </widget> + <addaction name="menu_File" /> + <addaction name="menu_Help" /> + </widget> + <widget class="QStatusBar" name="statusbar" /> + <action name="exitAction" > + <property name="text" > + <string>&Exit</string> + </property> + </action> + <action name="aboutQtAction" > + <property name="text" > + <string>About Qt</string> + </property> + </action> + <action name="editStyleAction" > + <property name="text" > + <string>Edit &Style</string> + </property> + </action> + <action name="aboutAction" > + <property name="text" > + <string>About</string> + </property> + </action> + </widget> + <tabstops> + <tabstop>maleRadioButton</tabstop> + <tabstop>femaleRadioButton</tabstop> + <tabstop>ageSpinBox</tabstop> + <tabstop>passwordEdit</tabstop> + <tabstop>professionList</tabstop> + <tabstop>agreeCheckBox</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/examples/widgets/stylesheet/layouts/pagefold.ui b/examples/widgets/stylesheet/layouts/pagefold.ui new file mode 100644 index 0000000..7ae313c --- /dev/null +++ b/examples/widgets/stylesheet/layouts/pagefold.ui @@ -0,0 +1,349 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>392</width> + <height>412</height> + </rect> + </property> + <property name="windowTitle" > + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QFrame" name="mainFrame" > + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="1" colspan="3" > + <widget class="QComboBox" name="nameCombo" > + <property name="toolTip" > + <string>Specify your name</string> + </property> + <property name="editable" > + <bool>true</bool> + </property> + <property name="currentIndex" > + <number>-1</number> + </property> + <item> + <property name="text" > + <string>Girish</string> + </property> + </item> + <item> + <property name="text" > + <string>Jasmin</string> + </property> + </item> + <item> + <property name="text" > + <string>Simon</string> + </property> + </item> + <item> + <property name="text" > + <string>Zack</string> + </property> + </item> + </widget> + </item> + <item row="1" column="3" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2" > + <widget class="QRadioButton" name="femaleRadioButton" > + <property name="styleSheet" > + <string>Check this if you are female</string> + </property> + <property name="text" > + <string>&Female</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="genderLabel" > + <property name="text" > + <string>Gender:</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="ageLabel" > + <property name="text" > + <string>&Age:</string> + </property> + <property name="buddy" > + <cstring>ageSpinBox</cstring> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QRadioButton" name="maleRadioButton" > + <property name="toolTip" > + <string>Check this if you are male</string> + </property> + <property name="text" > + <string>&Male</string> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="nameLabel" > + <property name="text" > + <string>&Name:</string> + </property> + <property name="buddy" > + <cstring>nameCombo</cstring> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="passwordLabel" > + <property name="text" > + <string>&Password:</string> + </property> + <property name="buddy" > + <cstring>passwordEdit</cstring> + </property> + </widget> + </item> + <item row="2" column="1" colspan="3" > + <widget class="QSpinBox" name="ageSpinBox" > + <property name="toolTip" > + <string>Specify your age</string> + </property> + <property name="statusTip" > + <string>Specify your age</string> + </property> + <property name="minimum" > + <number>12</number> + </property> + <property name="value" > + <number>22</number> + </property> + </widget> + </item> + <item row="7" column="2" colspan="2" > + <widget class="QDialogButtonBox" name="buttonBox" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="6" column="0" colspan="4" > + <widget class="QCheckBox" name="agreeCheckBox" > + <property name="toolTip" > + <string>Please read the LICENSE file before checking</string> + </property> + <property name="text" > + <string>I &accept the terms and &conditions</string> + </property> + </widget> + </item> + <item row="3" column="1" colspan="3" > + <widget class="QLineEdit" name="passwordEdit" > + <property name="toolTip" > + <string>Specify your password</string> + </property> + <property name="statusTip" > + <string>Specify your password</string> + </property> + <property name="text" > + <string>Password</string> + </property> + <property name="echoMode" > + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + <item row="5" column="1" colspan="3" > + <widget class="QListWidget" name="professionList" > + <property name="toolTip" > + <string>Select your profession</string> + </property> + <property name="statusTip" > + <string>Specify your name here</string> + </property> + <property name="whatsThis" > + <string>Specify your name here</string> + </property> + <property name="currentRow" > + <number>0</number> + </property> + <item> + <property name="text" > + <string>Developer</string> + </property> + </item> + <item> + <property name="text" > + <string>Student</string> + </property> + </item> + <item> + <property name="text" > + <string>Fisherman</string> + </property> + </item> + </widget> + </item> + <item row="5" column="0" > + <widget class="QLabel" name="label" > + <property name="text" > + <string>Profession:</string> + </property> + <property name="buddy" > + <cstring>professionList</cstring> + </property> + </widget> + </item> + <item row="4" column="1" colspan="3" > + <widget class="QComboBox" name="countryCombo" > + <property name="toolTip" > + <string>Specify country of origin</string> + </property> + <property name="statusTip" > + <string>Specify country of origin</string> + </property> + <property name="currentIndex" > + <number>6</number> + </property> + <item> + <property name="text" > + <string>Egypt</string> + </property> + </item> + <item> + <property name="text" > + <string>France</string> + </property> + </item> + <item> + <property name="text" > + <string>Germany</string> + </property> + </item> + <item> + <property name="text" > + <string>India</string> + </property> + </item> + <item> + <property name="text" > + <string>Italy</string> + </property> + </item> + <item> + <property name="text" > + <string>Korea</string> + </property> + </item> + <item> + <property name="text" > + <string>Norway</string> + </property> + </item> + </widget> + </item> + <item row="4" column="0" > + <widget class="QLabel" name="countryLabel" > + <property name="text" > + <string>Pro&fession</string> + </property> + <property name="buddy" > + <cstring>professionList</cstring> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>392</width> + <height>25</height> + </rect> + </property> + <widget class="QMenu" name="menu_File" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="editStyleAction" /> + <addaction name="separator" /> + <addaction name="exitAction" /> + </widget> + <widget class="QMenu" name="menu_Help" > + <property name="title" > + <string>&Help</string> + </property> + <addaction name="aboutAction" /> + <addaction name="separator" /> + <addaction name="aboutQtAction" /> + </widget> + <addaction name="menu_File" /> + <addaction name="menu_Help" /> + </widget> + <widget class="QStatusBar" name="statusbar" /> + <action name="exitAction" > + <property name="text" > + <string>&Exit</string> + </property> + </action> + <action name="aboutQtAction" > + <property name="text" > + <string>About Qt</string> + </property> + </action> + <action name="editStyleAction" > + <property name="text" > + <string>Edit &Style</string> + </property> + </action> + <action name="aboutAction" > + <property name="text" > + <string>About</string> + </property> + </action> + </widget> + <resources/> + <connections/> +</ui> diff --git a/examples/widgets/stylesheet/main.cpp b/examples/widgets/stylesheet/main.cpp new file mode 100644 index 0000000..931a89b --- /dev/null +++ b/examples/widgets/stylesheet/main.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + Q_INIT_RESOURCE(stylesheet); + + QApplication app(argc, argv); + MainWindow window; + window.show(); + return app.exec(); +} diff --git a/examples/widgets/stylesheet/mainwindow.cpp b/examples/widgets/stylesheet/mainwindow.cpp new file mode 100644 index 0000000..a1307a8 --- /dev/null +++ b/examples/widgets/stylesheet/mainwindow.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "mainwindow.h" +#include "stylesheeteditor.h" + +MainWindow::MainWindow() +{ + ui.setupUi(this); + + ui.nameLabel->setProperty("class", "mandatory QLabel"); + + styleSheetEditor = new StyleSheetEditor(this); + + statusBar()->addWidget(new QLabel(tr("Ready"))); + + connect(ui.exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + connect(ui.aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); +} + +void MainWindow::on_editStyleAction_triggered() +{ + styleSheetEditor->show(); + styleSheetEditor->activateWindow(); +} + +void MainWindow::on_aboutAction_triggered() +{ + QMessageBox::about(this, tr("About Style sheet"), + tr("The <b>Style Sheet</b> example shows how widgets can be styled " + "using <a href=\"http://doc.trolltech.com/4.5/stylesheet.html\">Qt " + "Style Sheets</a>. Click <b>File|Edit Style Sheet</b> to pop up the " + "style editor, and either choose an existing style sheet or design " + "your own.")); +} diff --git a/examples/widgets/stylesheet/mainwindow.h b/examples/widgets/stylesheet/mainwindow.h new file mode 100644 index 0000000..eedca88 --- /dev/null +++ b/examples/widgets/stylesheet/mainwindow.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QtGui> + +#include "ui_mainwindow.h" + +class StyleSheetEditor; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + +private slots: + void on_editStyleAction_triggered(); + void on_aboutAction_triggered(); + +private: + StyleSheetEditor *styleSheetEditor; + Ui::MainWindow ui; +}; + +#endif diff --git a/examples/widgets/stylesheet/mainwindow.ui b/examples/widgets/stylesheet/mainwindow.ui new file mode 100644 index 0000000..740d37b --- /dev/null +++ b/examples/widgets/stylesheet/mainwindow.ui @@ -0,0 +1,356 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>413</height> + </rect> + </property> + <property name="windowTitle" > + <string>Style Sheet</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QFrame" name="mainFrame" > + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="6" column="0" colspan="5" > + <widget class="QCheckBox" name="agreeCheckBox" > + <property name="toolTip" > + <string>Please read the LICENSE file before checking</string> + </property> + <property name="text" > + <string>I &accept the terms and &conditions</string> + </property> + </widget> + </item> + <item row="5" column="0" > + <widget class="QLabel" name="label" > + <property name="text" > + <string>Profession:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set> + </property> + <property name="buddy" > + <cstring>professionList</cstring> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="nameLabel" > + <property name="text" > + <string>&Name:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy" > + <cstring>nameCombo</cstring> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QRadioButton" name="maleRadioButton" > + <property name="toolTip" > + <string>Check this if you are male</string> + </property> + <property name="text" > + <string>&Male</string> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="passwordLabel" > + <property name="text" > + <string>&Password:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy" > + <cstring>passwordEdit</cstring> + </property> + </widget> + </item> + <item row="4" column="1" colspan="4" > + <widget class="QComboBox" name="countryCombo" > + <property name="toolTip" > + <string>Specify country of origin</string> + </property> + <property name="statusTip" > + <string>Specify country of origin</string> + </property> + <property name="currentIndex" > + <number>6</number> + </property> + <item> + <property name="text" > + <string>Egypt</string> + </property> + </item> + <item> + <property name="text" > + <string>France</string> + </property> + </item> + <item> + <property name="text" > + <string>Germany</string> + </property> + </item> + <item> + <property name="text" > + <string>India</string> + </property> + </item> + <item> + <property name="text" > + <string>Italy</string> + </property> + </item> + <item> + <property name="text" > + <string>Norway</string> + </property> + </item> + <item> + <property name="text" > + <string>Pakistan</string> + </property> + </item> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="ageLabel" > + <property name="text" > + <string>&Age:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy" > + <cstring>ageSpinBox</cstring> + </property> + </widget> + </item> + <item row="4" column="0" > + <widget class="QLabel" name="countryLabel" > + <property name="text" > + <string>Country:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy" > + <cstring>countryCombo</cstring> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="genderLabel" > + <property name="text" > + <string>Gender:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="1" colspan="4" > + <widget class="QLineEdit" name="passwordEdit" > + <property name="toolTip" > + <string>Specify your password</string> + </property> + <property name="statusTip" > + <string>Specify your password</string> + </property> + <property name="text" > + <string>Password</string> + </property> + <property name="echoMode" > + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + <item row="1" column="2" colspan="2" > + <widget class="QRadioButton" name="femaleRadioButton" > + <property name="styleSheet" > + <string>Check this if you are female</string> + </property> + <property name="text" > + <string>&Female</string> + </property> + </widget> + </item> + <item row="2" column="1" colspan="2" > + <widget class="QSpinBox" name="ageSpinBox" > + <property name="toolTip" > + <string>Specify your age</string> + </property> + <property name="statusTip" > + <string>Specify your age</string> + </property> + <property name="minimum" > + <number>12</number> + </property> + <property name="value" > + <number>22</number> + </property> + </widget> + </item> + <item row="0" column="1" colspan="4" > + <widget class="QComboBox" name="nameCombo" > + <property name="toolTip" > + <string>Specify your name</string> + </property> + <property name="editable" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="4" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="3" colspan="2" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="7" column="3" colspan="2" > + <widget class="QDialogButtonBox" name="buttonBox" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="5" column="1" colspan="4" > + <widget class="QListWidget" name="professionList" > + <property name="toolTip" > + <string>Select your profession</string> + </property> + <property name="statusTip" > + <string>Specify your name here</string> + </property> + <property name="whatsThis" > + <string>Specify your name here</string> + </property> + <property name="currentRow" > + <number>0</number> + </property> + <item> + <property name="text" > + <string>Developer</string> + </property> + </item> + <item> + <property name="text" > + <string>Student</string> + </property> + </item> + <item> + <property name="text" > + <string>Fisherman</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>29</height> + </rect> + </property> + <widget class="QMenu" name="menu_File" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="editStyleAction" /> + <addaction name="separator" /> + <addaction name="exitAction" /> + </widget> + <widget class="QMenu" name="menu_Help" > + <property name="title" > + <string>&Help</string> + </property> + <addaction name="aboutAction" /> + <addaction name="aboutQtAction" /> + </widget> + <addaction name="menu_File" /> + <addaction name="menu_Help" /> + </widget> + <widget class="QStatusBar" name="statusbar" /> + <action name="exitAction" > + <property name="text" > + <string>&Exit</string> + </property> + </action> + <action name="aboutQtAction" > + <property name="text" > + <string>About Qt</string> + </property> + </action> + <action name="editStyleAction" > + <property name="text" > + <string>Edit &Style...</string> + </property> + </action> + <action name="aboutAction" > + <property name="text" > + <string>About</string> + </property> + </action> + </widget> + <resources/> + <connections/> +</ui> diff --git a/examples/widgets/stylesheet/qss/coffee.qss b/examples/widgets/stylesheet/qss/coffee.qss new file mode 100644 index 0000000..4571d42 --- /dev/null +++ b/examples/widgets/stylesheet/qss/coffee.qss @@ -0,0 +1,112 @@ +.QWidget { + background-color: beige; +} + +/* Nice Windows-XP-style password character. */ +QLineEdit[echoMode="2"] { + lineedit-password-character: 9679; +} + +/* We provide a min-width and min-height for push buttons + so that they look elegant regardless of the width of the text. */ +QPushButton { + background-color: palegoldenrod; + border-width: 2px; + border-color: darkkhaki; + border-style: solid; + border-radius: 5; + padding: 3px; + min-width: 9ex; + min-height: 2.5ex; +} + +QPushButton:hover { + background-color: khaki; +} + +/* Increase the padding, so the text is shifted when the button is + pressed. */ +QPushButton:pressed { + padding-left: 5px; + padding-top: 5px; + background-color: #d0d67c; +} + +QLabel, QAbstractButton { + font: bold; +} + +/* Mark mandatory fields with a brownish color. */ +.mandatory { + color: brown; +} + +/* Bold text on status bar looks awful. */ +QStatusBar QLabel { + font: normal; +} + +QStatusBar::item { + border-width: 1; + border-color: darkkhaki; + border-style: solid; + border-radius: 2; +} + +QComboBox, QLineEdit, QSpinBox, QTextEdit, QListView { + background-color: cornsilk; + selection-color: #0a214c; + selection-background-color: #C19A6B; +} + +QListView { + show-decoration-selected: 1; +} + +QListView::item:hover { + background-color: wheat; +} + +/* We reserve 1 pixel space in padding. When we get the focus, + we kill the padding and enlarge the border. This makes the items + glow. */ +QLineEdit, QFrame { + border-width: 2px; + padding: 1px; + border-style: solid; + border-color: darkkhaki; + border-radius: 5px; +} + +/* As mentioned above, eliminate the padding and increase the border. */ +QLineEdit:focus, QFrame:focus { + border-width: 3px; + padding: 0px; +} + +/* A QLabel is a QFrame ... */ +QLabel { + border: none; + padding: 0; + background: none; +} + +/* A QToolTip is a QLabel ... */ +QToolTip { + border: 2px solid darkkhaki; + padding: 5px; + border-radius: 3px; + opacity: 200; +} + +/* Nice to have the background color change when hovered. */ +QRadioButton:hover, QCheckBox:hover { + background-color: wheat; +} + +/* Force the dialog's buttons to follow the Windows guidelines. */ +QDialogButtonBox { + button-layout: 0; +} + + diff --git a/examples/widgets/stylesheet/qss/default.qss b/examples/widgets/stylesheet/qss/default.qss new file mode 100644 index 0000000..84eb5e0 --- /dev/null +++ b/examples/widgets/stylesheet/qss/default.qss @@ -0,0 +1 @@ +/* empty stylesheet */ diff --git a/examples/widgets/stylesheet/qss/pagefold.qss b/examples/widgets/stylesheet/qss/pagefold.qss new file mode 100644 index 0000000..3701fc7 --- /dev/null +++ b/examples/widgets/stylesheet/qss/pagefold.qss @@ -0,0 +1,299 @@ +/* Customize any plain widget that is a child of a QMainWindow. */ +QMainWindow > .QWidget { + background-color: gainsboro; + background-image: url(:/images/pagefold.png); + background-position: top right; + background-repeat: no-repeat +} + +/* Provide a padding for the layout inside the frame. The frame + exists only to provide a padding for the top-right image, so we + explicitly disable the border. */ +#mainFrame { + padding-right: 30px; + border-style: none; + border-image: none; /* since we set a border-image below */ +} + +/* mainFrame won't have this border-image since we have + explicitly set it to 'none' using a more specific selector. */ +QFrame, QLineEdit, QComboBox[editable="true"], QSpinBox { + border-image: url(:/images/frame.png) 4; + border-width: 3; +} + +QLabel { + border: none; + border-image: none; + padding: 0; + background: none; +} + +/* Make text in message boxes selectable. */ +QMessageBox { + /* LinksAccessibleByMouse | TextSelectableByMouse */ + messagebox-text-interaction-flags: 5; +} + +/* Set the selection colors for all widgets. */ +QWidget { + selection-color: black; + selection-background-color: Silver; + color: black; +} + +/* Make the entire row selected in item views. */ +QAbstractItemView { + show-decoration-selected: 1; +} + +/* Nice WindowsXP-style password character for password line edits. */ +QLineEdit[echoMode="2"] { + lineedit-password-character: 9679; +} + +/* Customize tooltips. */ +QToolTip { + background-color: rgb(200,200,255); + border-color: darkslategray; + border-width: 1px; + border-style: solid; + padding: 3px; + font: bold; + border-radius: 3px; + opacity: 200; +} + +/* Customize radio buttons. */ + +QRadioButton { + spacing: 5px; +} + +QRadioButton::indicator { + width: 13px; + height: 13px; +} + +QRadioButton::indicator::unchecked { + image: url(:/images/radiobutton_unchecked.png); +} + +QRadioButton::indicator:unchecked:hover { + image: url(:/images/radiobutton_unchecked_hover.png); +} + +QRadioButton::indicator:unchecked:pressed { + image: url(:/images/radiobutton_unchecked_pressed.png); +} + +QRadioButton::indicator::checked { + image: url(:/images/radiobutton_checked.png); +} + +QRadioButton::indicator:checked:hover { + image: url(:/images/radiobutton_checked_hover.png); +} + +QRadioButton::indicator:checked:pressed { + image: url(:/images/radiobutton_checked_pressed.png); +} + +/* Customize arrows. */ + +*::down-arrow, *::menu-indicator { + image: url(:/images/down_arrow.png); + width: 7px; + height: 7px; +} + +*::down-arrow:disabled, *::down-arrow:off { + image: url(:/images/down_arrow_disabled.png); +} + +*::up-arrow { + image: url(:/images/up_arrow.png); + width: 7px; + height: 7px; +} + +*::up-arrow:disabled, *::up-arrow:off { + image: url(:/images/up_arrow_disabled.png); +} + +/* Customize push buttons and comboboxes. Our read-only combobox + is very similar to a push button, so they share the same border image. */ + +QPushButton { + min-width: 4em; +} + +QPushButton, QComboBox[editable="false"], +QComboBox[editable="true"]::drop-down { + border-image: url(:/images/pushbutton.png) 5; + border-width: 5; +} + +QPushButton:hover, QComboBox[editable="false"]:hover, +QComboBox[editable="true"]::drop-down:hover, QMenuBar::item:hover { + border-image: url(:/images/pushbutton_hover.png) 5; + border-width: 5; +} + +QPushButton:pressed, QComboBox[editable="false"]:on, +QComboBox[editable="true"]::drop-down:on, QMenuBar::item:on { + border-image: url(:/images/pushbutton_pressed.png) 5; + border-width: 5; +} + +/* Customize read-only comboboxes. */ + +QComboBox[editable="false"] { + padding-left: 3px; + padding-right: 20px; /* space for the arrow */ +} + +QComboBox[editable="false"]::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + border-left-style: solid; + border-left-color: darkgray; + border-left-width: 1px; +} + +QComboBox[editable="false"]::down-arrow { + subcontrol-origin: content; + subcontrol-position: center; + position: relative; + left: 1px; /* 1 pixel dropdown border */ +} + +/* The combobox arrow is on when the popup is open. */ +QComboBox[editable="false"]::down-arrow:on { + position: relative; + top: 1px; + left: 2px; +} + +/* Customize editable comboboxes. */ + +QComboBox[editable="true"] { + padding-right: 16px; +} + +QComboBox[editable="true"]::drop-down { + subcontrol-origin: border; + subcontrol-position: top right; + width: 13px; + position: absolute; + top: 2px; + bottom: 2px; + right: 2px; +} + +QComboBox[editable="true"]::drop-down, +QComboBox[editable="true"]::drop-down:hover, +QComboBox[editable="true"]::drop-down:on { + border-width: 0px; + border-left-width: 3px; /* we need only left and center part */ +} + +/* Shift the arrow when it's open. */ +QComboBox[editable="true"]::down-arrow:on { + position: relative; + top: 1px; + left: 1px; +} + +/* Customize check boxes. */ +QCheckBox { + spacing: 5px; +} + +QCheckBox::indicator { + width: 13px; + height: 13px; +} + +QCheckBox::indicator:unchecked { + image: url(:/images/checkbox_unchecked.png); +} + +QCheckBox::indicator:unchecked:hover { + image: url(:/images/checkbox_unchecked_hover.png); +} + +QCheckBox::indicator:unchecked:pressed { + image: url(:/images/checkbox_unchecked_pressed.png); +} + +QCheckBox::indicator:checked { + image: url(:/images/checkbox_checked.png); +} + +QCheckBox::indicator:checked:hover { + image: url(:/images/checkbox_checked_hover.png); +} + +QCheckBox::indicator:checked:pressed { + image: url(:/images/checkbox_checked_pressed.png); +} + +/* Customize the size grip. */ +QSizeGrip { + image: url(:/images/sizegrip.png); + width: 16px; + height: 16px; +} + +/* Customize the menu bar. */ +QMenuBar { + border-image: none; + border-style: none; + border-width: 1px; + border-bottom-style: solid; + border-bottom-color: darkslategray; + padding: 2px; +} + +/* Customize spin boxes. */ + +QSpinBox { + padding-right: 15px; +} + +QSpinBox::up-button { + subcontrol-origin: border; + subcontrol-position: top right; + + width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */ + border-image: url(:/images/spinup.png) 1; + border-width: 1px; +} + +QSpinBox::up-button:hover { + border-image: url(:/images/spinup_hover.png) 1; +} + +QSpinBox::up-button:pressed { + border-image: url(:/images/spinup_pressed.png) 1; +} + +QSpinBox::down-button { + subcontrol-origin: border; + subcontrol-position: bottom right; + + width: 16px; + border-image: url(:/images/spindown.png) 1; + border-width: 1px; + border-top-width: 0; +} + +QSpinBox::down-button:hover { + border-image: url(:/images/spindown_hover.png) 1; +} + +QSpinBox::down-button:pressed { + border-image: url(:/images/spindown_pressed.png) 1; +} diff --git a/examples/widgets/stylesheet/stylesheet.pro b/examples/widgets/stylesheet/stylesheet.pro new file mode 100644 index 0000000..71dfc6d --- /dev/null +++ b/examples/widgets/stylesheet/stylesheet.pro @@ -0,0 +1,16 @@ +HEADERS = mainwindow.h \ + stylesheeteditor.h +FORMS = mainwindow.ui \ + stylesheeteditor.ui +RESOURCES = stylesheet.qrc +SOURCES = main.cpp \ + mainwindow.cpp \ + stylesheeteditor.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/stylesheet +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro images layouts qss +sources.path = $$[QT_INSTALL_EXAMPLES]/widgets/stylesheet +INSTALLS += target sources + +include($$QT_SOURCE_TREE/examples/examplebase.pri) diff --git a/examples/widgets/stylesheet/stylesheet.qrc b/examples/widgets/stylesheet/stylesheet.qrc new file mode 100644 index 0000000..e1e61a9 --- /dev/null +++ b/examples/widgets/stylesheet/stylesheet.qrc @@ -0,0 +1,39 @@ +<RCC> +<qresource prefix="/"> + <file>layouts/default.ui</file> + <file>layouts/pagefold.ui</file> + <file>qss/coffee.qss</file> + <file>qss/default.qss</file> + <file>qss/pagefold.qss</file> + <file>images/pagefold.png</file> + <file>images/frame.png</file> + <file>images/radiobutton_unchecked.png</file> + <file>images/radiobutton_unchecked_pressed.png</file> + <file>images/radiobutton_unchecked_hover.png</file> + <file>images/radiobutton_checked.png</file> + <file>images/radiobutton_checked_pressed.png</file> + <file>images/radiobutton_checked_hover.png</file> + <file>images/pushbutton.png</file> + <file>images/pushbutton_hover.png</file> + <file>images/pushbutton_pressed.png</file> + <file>images/checkbox_unchecked.png</file> + <file>images/checkbox_unchecked_pressed.png</file> + <file>images/checkbox_unchecked_hover.png</file> + <file>images/checkbox_checked.png</file> + <file>images/checkbox_checked_pressed.png</file> + <file>images/checkbox_checked_hover.png</file> + <file>images/down_arrow.png</file> + <file>images/down_arrow_disabled.png</file> + <file>images/up_arrow.png</file> + <file>images/up_arrow_disabled.png</file> + <file>images/sizegrip.png</file> + <file>images/spinup.png</file> + <file>images/spinup_off.png</file> + <file>images/spinup_hover.png</file> + <file>images/spinup_pressed.png</file> + <file>images/spindown.png</file> + <file>images/spindown_off.png</file> + <file>images/spindown_hover.png</file> + <file>images/spindown_pressed.png</file> +</qresource> +</RCC> diff --git a/examples/widgets/stylesheet/stylesheeteditor.cpp b/examples/widgets/stylesheet/stylesheeteditor.cpp new file mode 100644 index 0000000..1210415 --- /dev/null +++ b/examples/widgets/stylesheet/stylesheeteditor.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "stylesheeteditor.h" + +StyleSheetEditor::StyleSheetEditor(QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); + + QRegExp regExp(".(.*)\\+?Style"); + QString defaultStyle = QApplication::style()->metaObject()->className(); + + if (regExp.exactMatch(defaultStyle)) + defaultStyle = regExp.cap(1); + + ui.styleCombo->addItems(QStyleFactory::keys()); + ui.styleCombo->setCurrentIndex(ui.styleCombo->findText(defaultStyle, Qt::MatchContains)); + ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText("Coffee")); + loadStyleSheet("Coffee"); +} + +void StyleSheetEditor::on_styleCombo_activated(const QString &styleName) +{ + qApp->setStyle(styleName); + ui.applyButton->setEnabled(false); +} + +void StyleSheetEditor::on_styleSheetCombo_activated(const QString &sheetName) +{ + loadStyleSheet(sheetName); +} + +void StyleSheetEditor::on_styleTextEdit_textChanged() +{ + ui.applyButton->setEnabled(true); +} + +void StyleSheetEditor::on_applyButton_clicked() +{ + qApp->setStyleSheet(ui.styleTextEdit->toPlainText()); + ui.applyButton->setEnabled(false); +} + +void StyleSheetEditor::loadStyleSheet(const QString &sheetName) +{ + QFile file(":/qss/" + sheetName.toLower() + ".qss"); + file.open(QFile::ReadOnly); + QString styleSheet = QLatin1String(file.readAll()); + + ui.styleTextEdit->setPlainText(styleSheet); + qApp->setStyleSheet(styleSheet); + ui.applyButton->setEnabled(false); +} diff --git a/examples/widgets/stylesheet/stylesheeteditor.h b/examples/widgets/stylesheet/stylesheeteditor.h new file mode 100644 index 0000000..bd90f9e --- /dev/null +++ b/examples/widgets/stylesheet/stylesheeteditor.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef STYLESHEETEDITOR_H +#define STYLESHEETEDITOR_H + +#include <QDialog> + +#include "ui_stylesheeteditor.h" + +class StyleSheetEditor : public QDialog +{ + Q_OBJECT + +public: + StyleSheetEditor(QWidget *parent = 0); + +private slots: + void on_styleCombo_activated(const QString &styleName); + void on_styleSheetCombo_activated(const QString &styleSheetName); + void on_styleTextEdit_textChanged(); + void on_applyButton_clicked(); + +private: + void loadStyleSheet(const QString &sheetName); + + Ui::StyleSheetEditor ui; +}; + +#endif diff --git a/examples/widgets/stylesheet/stylesheeteditor.ui b/examples/widgets/stylesheet/stylesheeteditor.ui new file mode 100644 index 0000000..34cd7f6 --- /dev/null +++ b/examples/widgets/stylesheet/stylesheeteditor.ui @@ -0,0 +1,171 @@ +<ui version="4.0" > + <class>StyleSheetEditor</class> + <widget class="QWidget" name="StyleSheetEditor" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>445</width> + <height>289</height> + </rect> + </property> + <property name="windowTitle" > + <string>Style Editor</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="6" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" > + <size> + <width>32</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="0" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" > + <size> + <width>32</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="5" > + <widget class="QComboBox" name="styleSheetCombo" > + <item> + <property name="text" > + <string>Default</string> + </property> + </item> + <item> + <property name="text" > + <string>Coffee</string> + </property> + </item> + <item> + <property name="text" > + <string>Pagefold</string> + </property> + </item> + </widget> + </item> + <item row="0" column="3" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" > + <size> + <width>10</width> + <height>16</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="2" > + <widget class="QComboBox" name="styleCombo" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLabel" name="label_7" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Style:</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="7" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>321</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="applyButton" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>&Apply</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0" colspan="7" > + <widget class="QTextEdit" name="styleTextEdit" /> + </item> + <item row="0" column="4" > + <widget class="QLabel" name="label_8" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Style Sheet:</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |