KStyleExtensions

KStyleExtensions Namespace Reference

Functions

QStyle::ControlElement customControlElement (const QString &element, const QWidget *widget)
 
static int customStyleElement (QStyle::StyleHint type, const QString &element, QWidget *widget)
 
QStyle::StyleHint customStyleHint (const QString &element, const QWidget *widget)
 
QStyle::SubElement customSubElement (const QString &element, const QWidget *widget)
 

Variables

static const QStyle::StyleHint SH_KCustomStyleElement = (QStyle::StyleHint)0xff000001
 
static const int X_KdeBase = 0xff000000
 

Detailed Description

Runtime style extensions You can use this to have a supporting QStyle implementation paint your widget This is just convenience and does /not/ require the using widgets style to inherit KStyle (i.e.

calling this while using cleanlooks won't segfault but just return "0")

For simplicity, only StyleHints, ControlElements and their SubElements are supported If you don't need extended SubElement functionality, just skip its usage

The element string has to be of the form: "appname.(2-char-element-type)_element" The 2-char-element-type is the corresponding {SH, CE, SE} Widgets in KWidgetsAddons don't have to pass the appname

Examples: "CE_CapacityBar", "amarok.CE_Analyzer"

Important notes: 1) If your string lacks the matching "SH_", "CE_" or "SE_" token the element request will be ignored (return is 0) 2) Try to avoid custom elements and use default ones (if possible) to get better style support and keep UI coherency 3) If you cache this value (good idea, this requires a map lookup) do not forget to catch style changes in QWidget::changeEvent()!

Function Documentation

KWIDGETSADDONS_EXPORT QStyle::ControlElement KStyleExtensions::customControlElement ( const QString element,
const QWidget widget 
)

Resolve a dynamic QStyle::ControlElement for eg.

QStyle::drawControl()

Returns
a unique QStyle::ControlElement or 0 in case the style doesn't support this element element a valid element string appname.CE_element, eg. "amarok.CE_Analyzer" widget the widget to paint this element for. This parameter is mandatory, nullptr will return 0!
Since
5.3

Definition at line 78 of file kstyleextensions.cpp.

KWIDGETSADDONS_EXPORT QStyle::StyleHint KStyleExtensions::customStyleHint ( const QString element,
const QWidget widget 
)

Resolve a dynamic QStyle::StyleHint to query QStyle::styleHint()

Returns
a unique QStyle::StyleHint or 0 in case the style doesn't suuport this element element a valid element string appname.SH_element, eg. "amarok.SH_Analyzer" widget the widget to paint this element for. This parameter is mandatory, nullptr will return 0!
Since
5.3

Definition at line 73 of file kstyleextensions.cpp.

KWIDGETSADDONS_EXPORT QStyle::SubElement KStyleExtensions::customSubElement ( const QString element,
const QWidget widget 
)

Resolve a dynamic QStyle::SubElement for eg.

QStyle::subElementRect()

Returns
a unique QStyle::SubElement or 0 in case the style doesn't suuport this element element a valid element string appname.SE_element, eg. "amarok.SE_AnalyzerCanvas" widget the widget to paint this element for. This parameter is mandatory, nullptr will return 0!
Since
5.3

Definition at line 83 of file kstyleextensions.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jul 4 2020 22:44:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.