Move stylesheets example to manual test
Pick-to: 6.5 6.6 Change-Id: If0206e63546bf948af4cfb65773e2662c53a5e79 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Before Width: | Height: | Size: 28 KiB |
@ -1,64 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\example widgets/stylesheet
|
|
||||||
\title Style Sheet Example
|
|
||||||
\ingroup examples-widgets
|
|
||||||
\brief The Style Sheet Example shows how to use style sheets.
|
|
||||||
|
|
||||||
\borderedimage stylesheet-pagefold.png
|
|
||||||
\caption Screen Shot of the Pagefold style sheet
|
|
||||||
|
|
||||||
The Style Sheet example shows how widgets can be styled using Qt Style Sheets.
|
|
||||||
You can open the style editor by selecting \uicontrol File > \uicontrol Edit Style Sheet,
|
|
||||||
to select an existing style sheet or design your own style and load it.
|
|
||||||
|
|
||||||
The Style Sheet example consists of 2 classes:
|
|
||||||
\list
|
|
||||||
\li \c MainWindow
|
|
||||||
\li \c StyleSheetEditor
|
|
||||||
\endlist
|
|
||||||
|
|
||||||
|
|
||||||
\section1 MainWindow Class
|
|
||||||
|
|
||||||
\c MainWindow inherits QWidget, and is the application's main window defined in
|
|
||||||
\c mainwindow.ui. The style of \c MainWindow can be modified with \c StyleSheetEditor.
|
|
||||||
|
|
||||||
|
|
||||||
\section1 StyleSheetEditor Class
|
|
||||||
|
|
||||||
\c StyleSheetEditor enables you to open an editor where you can load an existing style sheet.
|
|
||||||
It is also possible to define a new stylesheet and load it. Its layout is defined in
|
|
||||||
\c stylesheeteditor.ui.
|
|
||||||
|
|
||||||
\quotefromfile widgets/stylesheet/stylesheeteditor.cpp
|
|
||||||
\skipto setStyleName
|
|
||||||
\printline setStyleName
|
|
||||||
|
|
||||||
Sets the specified \a styleName and grays the \c applyButton.
|
|
||||||
|
|
||||||
\skipto setStyleSheetName
|
|
||||||
\printline setStyleSheetName
|
|
||||||
|
|
||||||
Loads the stylesheet from \c styleSheetName.
|
|
||||||
|
|
||||||
\skipto setModified()
|
|
||||||
\printline setModified()
|
|
||||||
|
|
||||||
Enables the \c applyButton when the text in the buffer has changed.
|
|
||||||
|
|
||||||
\skipto apply()
|
|
||||||
\printline apply()
|
|
||||||
|
|
||||||
Sets the stylesheet properties in \l qApp and disables the \c applyButton.
|
|
||||||
|
|
||||||
\skipto loadStyleSheet(const QString &sheetName)
|
|
||||||
\printline loadStyleSheet(const QString &sheetName)
|
|
||||||
|
|
||||||
Loads the specified \a sheetName, and sets its properties in
|
|
||||||
\l qApp.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
@ -12,7 +12,6 @@ qt_internal_add_example(shortcuteditor)
|
|||||||
qt_internal_add_example(sliders)
|
qt_internal_add_example(sliders)
|
||||||
qt_internal_add_example(spinboxes)
|
qt_internal_add_example(spinboxes)
|
||||||
qt_internal_add_example(styles)
|
qt_internal_add_example(styles)
|
||||||
qt_internal_add_example(stylesheet)
|
|
||||||
qt_internal_add_example(tablet)
|
qt_internal_add_example(tablet)
|
||||||
qt_internal_add_example(tetrix)
|
qt_internal_add_example(tetrix)
|
||||||
qt_internal_add_example(tooltips)
|
qt_internal_add_example(tooltips)
|
||||||
|
@ -9,7 +9,6 @@ SUBDIRS = analogclock \
|
|||||||
sliders \
|
sliders \
|
||||||
spinboxes \
|
spinboxes \
|
||||||
styles \
|
styles \
|
||||||
stylesheet \
|
|
||||||
tablet \
|
tablet \
|
||||||
tetrix \
|
tetrix \
|
||||||
tooltips \
|
tooltips \
|
||||||
|
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 20 KiB |
@ -85,22 +85,7 @@
|
|||||||
buttons and check boxes to make them stand out. Using this
|
buttons and check boxes to make them stand out. Using this
|
||||||
technique, you can also achieve minor customizations that would
|
technique, you can also achieve minor customizations that would
|
||||||
normally require subclassing several style classes, such as
|
normally require subclassing several style classes, such as
|
||||||
specifying a \l{QStyle::styleHint()}{style hint}. The
|
specifying a \l{QStyle::styleHint()}{style hint}.
|
||||||
\l{widgets/stylesheet}{Style Sheet} example depicted below defines
|
|
||||||
two distinctive style sheets that you can try out and modify at
|
|
||||||
will.
|
|
||||||
|
|
||||||
\table
|
|
||||||
\row \li \inlineimage stylesheet-pagefold.png
|
|
||||||
\row \li Pagefold theme running on Windows
|
|
||||||
\endtable
|
|
||||||
|
|
||||||
\table
|
|
||||||
\row \li \inlineimage stylesheet-coffee-cleanlooks.png
|
|
||||||
\li \inlineimage stylesheet-pagefold-mac.png
|
|
||||||
\row \li Coffee theme running on Ubuntu Linux
|
|
||||||
\li Pagefold theme running on \macos
|
|
||||||
\endtable
|
|
||||||
|
|
||||||
When a style sheet is active, the QStyle returned by QWidget::style()
|
When a style sheet is active, the QStyle returned by QWidget::style()
|
||||||
is a wrapper "style sheet" style, \e not the platform-specific style. The
|
is a wrapper "style sheet" style, \e not the platform-specific style. The
|
||||||
@ -4073,7 +4058,7 @@
|
|||||||
|
|
||||||
\image stylesheet-treeview.png
|
\image stylesheet-treeview.png
|
||||||
|
|
||||||
\sa {Style Sheet Example}, {Supported HTML Subset}, QStyle
|
\sa {Supported HTML Subset}, QStyle
|
||||||
|
|
||||||
|
|
||||||
\section1 Common Mistakes
|
\section1 Common Mistakes
|
||||||
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 425 B After Width: | Height: | Size: 425 B |
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 533 B After Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 513 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 532 B After Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 492 B After Width: | Height: | Size: 492 B |
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |