KDEUI
#include <kstyle.h>
Classes | |
struct | CheckBox |
class | ColorMode |
struct | ColorOption |
struct | ComboBox |
struct | DockWidget |
struct | DoubleButtonOption |
struct | Generic |
struct | GroupBox |
struct | Header |
struct | IconOption |
struct | LineEdit |
struct | Menu |
struct | MenuBar |
struct | MenuBarItem |
struct | MenuItem |
struct | Option |
struct | OptionBase |
struct | ProgressBar |
struct | PushButton |
struct | RadioButton |
struct | ScrollBar |
struct | Slider |
struct | SpinBox |
struct | Splitter |
struct | StatusBar |
struct | TabBar |
struct | TabWidget |
struct | TextOption |
struct | TitleButtonOption |
struct | ToolBar |
struct | ToolBoxTab |
struct | ToolButton |
struct | Tree |
struct | Window |
Public Member Functions | |
KStyle () | |
~KStyle () | |
Public Member Functions inherited from QCommonStyle | |
QCommonStyle () | |
~QCommonStyle () | |
Public Member Functions inherited from QStyle | |
QStyle () | |
virtual | ~QStyle () |
int | combinedLayoutSpacing (QFlags< QSizePolicy::ControlType > controls1, QFlags< QSizePolicy::ControlType > controls2, Qt::Orientation orientation, QStyleOption *option, QWidget *widget) const |
virtual void | drawComplexControl (ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const =0 |
virtual void | drawControl (ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0 |
virtual void | drawPrimitive (PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0 |
virtual QPixmap | generatedIconPixmap (QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const =0 |
virtual SubControl | hitTestComplexControl (ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const =0 |
int | layoutSpacing (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const |
virtual int | pixelMetric (PixelMetric metric, const QStyleOption *option, const QWidget *widget) const =0 |
const QStyle * | proxy () const |
virtual QSize | sizeFromContents (ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const =0 |
QIcon | standardIcon (StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const |
virtual QPixmap | standardPixmap (StandardPixmap standardPixmap, const QStyleOption *option, const QWidget *widget) const =0 |
virtual int | styleHint (StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const =0 |
virtual QRect | subControlRect (ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const =0 |
virtual QRect | subElementRect (SubElement element, const QStyleOption *option, const QWidget *widget) const =0 |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Static Public Member Functions | |
static ControlElement | customControlElement (const QString &element, const QWidget *widget) |
static StyleHint | customStyleHint (const QString &element, const QWidget *widget) |
static SubElement | customSubElement (const QString &element, const QWidget *widget) |
static QString | defaultStyle () |
Static Public Member Functions inherited from QStyle | |
QRect | alignedRect (Qt::LayoutDirection direction, QFlags< Qt::AlignmentFlag > alignment, const QSize &size, const QRect &rectangle) |
int | sliderPositionFromValue (int min, int max, int logicalValue, int span, bool upsideDown) |
int | sliderValueFromPosition (int min, int max, int position, int span, bool upsideDown) |
Qt::Alignment | visualAlignment (Qt::LayoutDirection direction, QFlags< Qt::AlignmentFlag > alignment) |
QPoint | visualPos (Qt::LayoutDirection direction, const QRect &boundingRectangle, const QPoint &logicalPosition) |
QRect | visualRect (Qt::LayoutDirection direction, const QRect &boundingRectangle, const QRect &logicalRectangle) |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Types | |
enum | MarginOffsets { MainMargin, Top, Bot, Left, Right, MarginInc } |
enum | WidgetType { WT_Generic, WT_PushButton, WT_Splitter, WT_CheckBox, WT_RadioButton, WT_DockWidget, WT_ProgressBar, WT_MenuBar, WT_MenuBarItem, WT_Menu, WT_MenuItem, WT_ScrollBar, WT_TabBar, WT_TabWidget, WT_Slider, WT_Tree, WT_SpinBox, WT_ComboBox, WT_Header, WT_LineEdit, WT_GroupBox, WT_StatusBar, WT_ToolBar, WT_ToolButton, WT_ToolBoxTab, WT_Window, WT_Limit = 0xFFFF } |
Protected Member Functions | |
virtual void | drawKStylePrimitive (WidgetType widgetType, int primitive, const QStyleOption *opt, const QRect &r, const QPalette &pal, State flags, QPainter *p, const QWidget *widget=0, Option *kOpt=0) const |
ControlElement | newControlElement (const QString &element) |
StyleHint | newStyleHint (const QString &element) |
SubElement | newSubElement (const QString &element) |
void | setWidgetLayoutProp (WidgetType widget, int metric, int value) |
virtual int | widgetLayoutProp (WidgetType widgetType, int metric, const QStyleOption *opt=0, const QWidget *w=0) const |
Helper Methods | |
These are methods helping with QRect handling, for example. | |
void | drawInsideRect (QPainter *p, const QRect &r) const |
QRect | centerRect (const QRect &in, int w, int h) const |
QRect | centerRect (const QRect &in, const QSize &size) const |
Protected Member Functions inherited from QStyle | |
int | layoutSpacingImplementation (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const |
QIcon | standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions | |
template<typename T > | |
static T | extractOption (Option *option) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
QStyle Methods | |
These are methods reimplemented from QStyle. Usually it's not necessary to reimplement them yourself. Some of them are there for binary compatibility reasons only; all they do is to call the implementation from QCommonStyle. | |
void | drawControl (ControlElement elem, const QStyleOption *opt, QPainter *p, const QWidget *w) const |
void | drawPrimitive (PrimitiveElement elem, const QStyleOption *opt, QPainter *p, const QWidget *w) const |
int | pixelMetric (PixelMetric metric, const QStyleOption *opt=0, const QWidget *w=0) const |
QRect | subElementRect (SubElement subRect, const QStyleOption *opt, const QWidget *w) const |
QSize | sizeFromContents (ContentsType type, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w) const |
int | styleHint (StyleHint hint, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *returnData) const |
QRect | subControlRect (ComplexControl control, const QStyleOptionComplex *opt, SubControl subControl, const QWidget *w) const |
SubControl | hitTestComplexControl (ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w) const |
void | drawComplexControl (ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w) const |
void | polish (QWidget *) |
void | unpolish (QWidget *) |
void | polish (QApplication *) |
void | unpolish (QApplication *) |
void | polish (QPalette &) |
QRect | itemTextRect (const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const |
QRect | itemPixmapRect (const QRect &r, int flags, const QPixmap &pixmap) const |
void | drawItemText (QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const |
void | drawItemPixmap (QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const |
QPalette | standardPalette () const |
QPixmap | standardPixmap (StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const |
QPixmap | generatedIconPixmap (QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const |
bool | eventFilter (QObject *, QEvent *) |
int | layoutSpacingImplementation (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const |
QIcon | standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const |
Additional Inherited Members | |
Public Attributes inherited from QStyle | |
typedef | State |
typedef | SubControls |
Properties inherited from QObject | |
objectName | |
Detailed Description
Makes style coding more convenient.
KStyle strives to ease style development by implementing various QStyle methods. These implementations are based on
- the concept of Layout Properties. These properties can be set using setWidgetLayoutProp(). KStyle uses this information to respect various metrics (like space between primitives or margins around widget contents) or turn specific features on or off.
- the concept of KStyle Primitives. These can be implemented by overriding drawKStylePrimitive() and providing drawing methods for specific primitives. Often, the drawing of more complex widgets consists of several primitives.
In the following modules, information about related members is collected:
- See also
- KStyleFactory for how to implement the style plugin interface.
Constructor & Destructor Documentation
KStyle::KStyle | ( | ) |
Definition at line 141 of file kstyle.cpp.
KStyle::~KStyle | ( | ) |
Definition at line 273 of file kstyle.cpp.
Member Function Documentation
Returns a w x h QRect center inside the 'in' rectangle.
Definition at line 599 of file kstyle.cpp.
Return a size-dimension QRect centered inside the 'in' rectangle.
Definition at line 604 of file kstyle.cpp.
|
static |
Definition at line 391 of file kstyle.cpp.
|
static |
Runtime element extension 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 or so but just return 0) Returns a unique id for an element string (e.g. "CE_CapacityBar")
For simplicity, only StyleHints, ControlElements and their SubElements are supported If you don't need extended SubElement functionality, just drop it
- Parameters
-
element The style element, represented as string. Naming convention: "appname.(2-char-element-type)_element" where the 2-char-element-type is of {SH, CE, SE} (widgets in kdelibs don't have to pass the appname) examples: "CE_CapacityBar", "amarok.CE_Analyzer" widget Your widget ("this") passing this is mandatory, passing NULL will just return 0
- Returns
- a unique id for the
element
string or 0, if the element is not supported by the widgets current style
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) don't (!) forget to catch style changes in QWidget::changeEvent()
Definition at line 386 of file kstyle.cpp.
|
static |
Definition at line 396 of file kstyle.cpp.
|
static |
Returns the default widget style.
Definition at line 360 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 3155 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 1327 of file kstyle.cpp.
Draws inside the rectangle using a thinkness 0 pen.
This is what drawRect in Qt3 used to do.
Definition at line 594 of file kstyle.cpp.
|
virtual |
Reimplemented from QStyle.
Definition at line 451 of file kstyle.cpp.
|
virtual |
Reimplemented from QStyle.
Definition at line 444 of file kstyle.cpp.
|
protectedvirtual |
Draws primitives which are used inside KStyle.
KStyle implements various elements of QStyle::ComplexControl and QStyle::ControlElement for convenience. Usually complex drawing is split into smaller pieces, which can be text, icons, or other KStyle primitives. These are painted by this method.
Common Qt option parameters are unpacked for convenience, and information from KStyle are passed as a KStyleOption.
- Note
- This method is not meant to be accessible from outside KStyle.
-
You should make sure to use the
r
parameter for the rectangle, since the QStyleOption is generally unaltered from the original request, even if layout indicates a different painting rectangle.
- Parameters
-
widgetType the widget context in which this call is happening in primitive the primitive which should be called. Primitives from the Generic struct are not directly coupled to the widgetType
, other primitives are usually defined in the struct corresponding to the widget type.opt Qt option parameters r parameter for the rectangle pal the palette extracted from opt
for convenienceflags state flags extracted from opt
for conveniencep used to draw the primitive widget the widget which is painted on kOpt information passed from KStyle
Definition at line 611 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 979 of file kstyle.cpp.
Reimplemented from QObject.
Definition at line 4374 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 588 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 4039 of file kstyle.cpp.
Reimplemented from QStyle.
Definition at line 440 of file kstyle.cpp.
|
virtual |
Reimplemented from QStyle.
Definition at line 434 of file kstyle.cpp.
|
protectedslot |
Definition at line 2833 of file kstyle.cpp.
|
protected |
Definition at line 349 of file kstyle.cpp.
|
protected |
Runtime element extension, allows inheriting styles to add support custom elements merges supporting inherit chains Supposed to be called e.g.
in your constructor.
NOTICE: in order to have this work, your style must provide an "X-KDE-CustomElements" classinfo, i.e. class MyStyle : public KStyle { Q_OBJECT Q_CLASSINFO ("X-KDE-CustomElements", "true")
public: ..... }
- Parameters
-
element The style element, represented as string. Suggested naming convention: appname.(2-char-element-type)_element where the 2-char-element-type is of {SH, CE, SE} widgets in kdelibs 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) To keep UI coherency, don't support any nonsense in your style, but convince app developers to use standard elements - if available
Definition at line 344 of file kstyle.cpp.
|
protected |
Definition at line 354 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 2589 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 401 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 422 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 430 of file kstyle.cpp.
|
protected |
Interface for the style to configure various metrics that KStyle has customizable.
Definition at line 901 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 4092 of file kstyle.cpp.
|
protectedslot |
Definition at line 462 of file kstyle.cpp.
|
virtual |
Reimplemented from QStyle.
Definition at line 456 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 583 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 2512 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 3650 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 2962 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 414 of file kstyle.cpp.
|
virtual |
Reimplemented from QCommonStyle.
Definition at line 426 of file kstyle.cpp.
|
protectedvirtual |
Used to obtain information about KStyle layout properties and metrics.
The default implementation returns values which are set using setWidgetLayoutProp(), so normally it's not necessary to implement it yourself.
- Note
- This method is not meant to be accessible from outside KStyle.
- Parameters
-
widgetType the widget type context where the metric
property belongs tometric the value of this property is requested opt Qt option parameters w the actual widget this call is related to
Definition at line 913 of file kstyle.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.