Style Sheet Example¶
Style Sheet Example shows how to use style sheets
mainwindow.cpp Example File¶
mainwindow.h Example File¶
mainwindow.ui Example File¶
stylesheeteditor.cpp Example File¶
stylesheeteditor.h Example File¶
stylesheeteditor.ui Example File¶
default.ui Example File¶
pagefold.ui Example File¶
main.cpp Example File¶
stylesheet.pro Example File¶
stylesheet.qrc Example File¶
checkbox_checked.png Image File¶
checkbox_checked_hover.png Image File¶
checkbox_checked_pressed.png Image File¶
checkbox_unchecked.png Image File¶
checkbox_unchecked_hover.png Image File¶
checkbox_unchecked_pressed.png Image File¶
down_arrow.png Image File¶
down_arrow_disabled.png Image File¶
frame.png Image File¶
pagefold.png Image File¶
pushbutton.png Image File¶
pushbutton_hover.png Image File¶
pushbutton_pressed.png Image File¶
radiobutton_checked.png Image File¶
radiobutton_checked_hover.png Image File¶
radiobutton_checked_pressed.png Image File¶
radiobutton_unchecked.png Image File¶
radiobutton_unchecked_hover.png Image File¶
radiobutton_unchecked_pressed.png Image File¶
sizegrip.png Image File¶
spindown.png Image File¶
spindown_hover.png Image File¶
spindown_off.png Image File¶
spindown_pressed.png Image File¶
spinup.png Image File¶
spinup_hover.png Image File¶
spinup_off.png Image File¶
spinup_pressed.png Image File¶
up_arrow.png Image File¶
up_arrow_disabled.png Image File¶
The Style Sheet Example shows how to use style sheets.
The Style Sheet example shows how widgets can be styled using Qt Style Sheets. You can open the style editor by selecting File > 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:
MainWindow
StyleSheetEditor
MainWindow Class¶
MainWindow
inherits QWidget , and is the application’s main window defined inmainwindow.ui
. The style ofMainWindow
can be modified withStyleSheetEditor
.
StyleSheetEditor Class¶
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 instylesheeteditor.ui
.Sets the specified
styleName
and grays theapplyButton
.Loads the stylesheet from
styleSheetName
.Enables the
applyButton
when the text in the buffer has changed.Sets the stylesheet properties in
qApp()
and disables theapplyButton
.Loads the specified
sheetName
, and sets its properties inqApp()
.