|
KanoopGuiQt 1.3.0
Qt GUI utility library
|
|
Template helper for building typed Qt stylesheet strings. More...
#include <stylesheet.h>
Public Member Functions | |
| StyleSheet () | |
| Construct and capture the widget class name as the CSS selector. | |
| void | setProperty (StyleSheetProperty property, const QString &value) |
| Set a stylesheet property to a string value. | |
| void | setProperty (StyleSheetProperty property, const QColor &value) |
| Set a stylesheet property to a color value. | |
| void | setPropertyPixels (StyleSheetProperty property, int value) |
| Set a stylesheet property to a pixel integer value. | |
| void | setGradient (const QString &gradient) |
| Set the background to a gradient string (qradialgradient / qlineargradient). | |
| void | setRadialGradient (double cx, double cy, double radius, double fx, double fy, const QGradientStops &stops) |
| Set the background to a radial gradient specified by its geometric parameters. | |
| void | setBorder (const QString &topLeft, const QString &bottomRight) |
| Set all four border properties at once using the dome highlight/shadow convention. | |
| void | setBorder (int widthPx, const QColor &topLeft, const QColor &bottomRight) |
| Set all four border properties using a pixel width and two colors. | |
| void | setPseudoState (StyleSheetPseudoState value) |
| Set the pseudo-state selector (e.g., PS_Hover, PS_Checked). | |
| void | setSubControl (const QString &value) |
| Set the sub-control selector string (e.g., "::handle"). | |
| QString | toString () const |
| Render all accumulated properties into a complete stylesheet rule. | |
Public Attributes | |
| QString | _typeName |
| CSS selector class name (set from T::metaObject()->className()). | |
| QMap< StyleSheetProperty, QString > | _properties |
| Accumulated property/value pairs for the stylesheet rule. | |
| StyleSheetPseudoState | _pseudoState = PS_Invalid |
| Pseudo-state selector applied to the rule (PS_Invalid = none). | |
| QString | _subControl |
| Sub-control selector string (empty = none). | |
Template helper for building typed Qt stylesheet strings.
StyleSheet<T> is parameterized on a QWidget subclass. It captures the widget's class name at construction and accumulates property/value pairs that are rendered into a complete stylesheet rule by toString().
An optional pseudo-state (e.g., PS_Hover) and sub-control selector can narrow the rule to a specific widget state or part.
| T | QWidget subclass whose class name is used as the selector |
Definition at line 25 of file stylesheet.h.
|
inline |
Construct and capture the widget class name as the CSS selector.
Definition at line 31 of file stylesheet.h.
| void StyleSheet< T >::setBorder | ( | const QString & | topLeft, |
| const QString & | bottomRight | ||
| ) |
Set all four border properties at once using the dome highlight/shadow convention.
Top and left edges receive topLeft (highlight); bottom and right receive bottomRight (shadow). This matches the standard glassy-dome button style used throughout the UI.
| topLeft | CSS border value for the top and left edges |
| bottomRight | CSS border value for the bottom and right edges |
| void StyleSheet< T >::setBorder | ( | int | widthPx, |
| const QColor & | topLeft, | ||
| const QColor & | bottomRight | ||
| ) |
Set all four border properties using a pixel width and two colors.
Generates "Npx solid rgba(r,g,b,a)" strings for top/left and bottom/right edges, then delegates to the string overload.
| widthPx | Border thickness in pixels |
| topLeft | Color for top and left edges (highlight) |
| bottomRight | Color for bottom and right edges (shadow) |
|
inline |
Set the background to a gradient string (qradialgradient / qlineargradient).
| gradient | Full CSS gradient value string |
Definition at line 63 of file stylesheet.h.
| void StyleSheet< T >::setProperty | ( | StyleSheetProperty | property, |
| const QColor & | value | ||
| ) |
Set a stylesheet property to a color value.
| property | Property identifier |
| value | Color to convert to a CSS color string |
| void StyleSheet< T >::setProperty | ( | StyleSheetProperty | property, |
| const QString & | value | ||
| ) |
Set a stylesheet property to a string value.
| property | Property identifier |
| value | String value for the property |
| void StyleSheet< T >::setPropertyPixels | ( | StyleSheetProperty | property, |
| int | value | ||
| ) |
Set a stylesheet property to a pixel integer value.
| property | Property identifier |
| value | Size in pixels |
|
inline |
Set the pseudo-state selector (e.g., PS_Hover, PS_Checked).
| value | Pseudo-state enum value |
Definition at line 109 of file stylesheet.h.
| void StyleSheet< T >::setRadialGradient | ( | double | cx, |
| double | cy, | ||
| double | radius, | ||
| double | fx, | ||
| double | fy, | ||
| const QGradientStops & | stops | ||
| ) |
Set the background to a radial gradient specified by its geometric parameters.
Generates a CSS qradialgradient() value from the given parameters and passes it to setGradient(). Colors are converted to rgba() notation so alpha is always preserved.
| cx | Centre x (0–1) |
| cy | Centre y (0–1) |
| radius | Radius (0–1) |
| fx | Focal-point x (0–1) |
| fy | Focal-point y (0–1) |
| stops | Gradient stops (position in 0–1 and color, including alpha) |
|
inline |
Set the sub-control selector string (e.g., "::handle").
| value | Sub-control string |
Definition at line 115 of file stylesheet.h.
| QString StyleSheet< T >::toString | ( | ) | const |
Render all accumulated properties into a complete stylesheet rule.
| QMap<StyleSheetProperty, QString> StyleSheet< T >::_properties |
Accumulated property/value pairs for the stylesheet rule.
Definition at line 128 of file stylesheet.h.
| StyleSheetPseudoState StyleSheet< T >::_pseudoState = PS_Invalid |
Pseudo-state selector applied to the rule (PS_Invalid = none).
Definition at line 130 of file stylesheet.h.
| QString StyleSheet< T >::_subControl |
Sub-control selector string (empty = none).
Definition at line 132 of file stylesheet.h.
| QString StyleSheet< T >::_typeName |
CSS selector class name (set from T::metaObject()->className()).
Definition at line 125 of file stylesheet.h.