Qt 4.8
|
The QProxyStyle class is a convenience class that simplifies dynamically overriding QStyle elements. More...
#include <qproxystyle.h>
Public Functions | |
QStyle * | baseStyle () const |
Returns the proxy base style object. More... | |
void | drawComplexControl (ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget=0) const |
Reimplemented Function More... | |
void | drawControl (ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const |
Reimplemented Function More... | |
virtual void | drawItemPixmap (QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const |
Reimplemented Function More... | |
void | drawItemText (QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const |
Reimplemented Function More... | |
void | drawPrimitive (PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const |
Reimplemented Function More... | |
QPixmap | generatedIconPixmap (QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const |
Reimplemented Function More... | |
SubControl | hitTestComplexControl (ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget=0) const |
Reimplemented Function More... | |
QRect | itemPixmapRect (const QRect &r, int flags, const QPixmap &pixmap) const |
Reimplemented Function More... | |
QRect | itemTextRect (const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const |
Reimplemented Function More... | |
int | pixelMetric (PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const |
Reimplemented Function More... | |
void | polish (QWidget *widget) |
Reimplemented Function More... | |
void | polish (QPalette &pal) |
Reimplemented Function More... | |
void | polish (QApplication *app) |
Reimplemented Function More... | |
QProxyStyle (QStyle *baseStyle=0) | |
Constructs a QProxyStyle object for overriding behavior in style or in the current application style if style is 0 (default). More... | |
void | setBaseStyle (QStyle *style) |
Sets the base style that should be proxied. More... | |
QSize | sizeFromContents (ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const |
Reimplemented Function More... | |
QPalette | standardPalette () const |
Reimplemented Function More... | |
QPixmap | standardPixmap (StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const |
Reimplemented Function More... | |
int | styleHint (StyleHint hint, const QStyleOption *option=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const |
Reimplemented Function More... | |
QRect | subControlRect (ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const |
Reimplemented Function More... | |
QRect | subElementRect (SubElement element, const QStyleOption *option, const QWidget *widget) const |
Reimplemented Function More... | |
void | unpolish (QWidget *widget) |
Reimplemented Function More... | |
void | unpolish (QApplication *app) |
Reimplemented Function More... | |
~QProxyStyle () | |
Destroys the QProxyStyle object. More... | |
Public Functions inherited from QCommonStyle | |
QCommonStyle () | |
Constructs a QCommonStyle. More... | |
~QCommonStyle () | |
Destroys the style. More... | |
Public Functions inherited from QStyle | |
int | combinedLayoutSpacing (QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option=0, QWidget *widget=0) const |
Returns the spacing that should be used between controls1 and controls2 in a layout. More... | |
int | layoutSpacing (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const |
Returns the spacing that should be used between control1 and control2 in a layout. More... | |
const QStyle * | proxy () const |
QStyle () | |
Constructs a style object. More... | |
QIcon | standardIcon (StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const |
Returns an icon for the given standardIcon. More... | |
virtual | ~QStyle () |
Destroys the style object. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Protected Slots | |
int | layoutSpacingImplementation (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const |
This slot is called by layoutSpacing() to determine the spacing that should be used between control1 and control2 in a layout. More... | |
QIcon | standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const |
Returns an icon for the given standardIcon. More... | |
Protected Slots inherited from QCommonStyle | |
QIcon | standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *opt=0, const QWidget *widget=0) const |
Protected Slots inherited from QStyle | |
int | layoutSpacingImplementation (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const |
This slot is called by layoutSpacing() to determine the spacing that should be used between control1 and control2 in a layout. More... | |
QIcon | standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *opt=0, const QWidget *widget=0) const |
Returns an icon for the given standardIcon. More... | |
Protected Functions | |
bool | event (QEvent *e) |
Reimplemented Function More... | |
Protected Functions inherited from QCommonStyle | |
QCommonStyle (QCommonStylePrivate &dd) | |
Protected Functions inherited from QStyle | |
QStyle (QStylePrivate &dd) | |
Constructs a style object. More... | |
Protected Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *) |
This event handler can be reimplemented in a subclass to receive child events. More... | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
The QProxyStyle class is a convenience class that simplifies dynamically overriding QStyle elements.
A QProxyStyle wraps a QStyle (usually the default system style) for the purpose of dynamically overriding painting or other specific style behavior.
The following example shows how to override the shortcut underline behavior on any platform:
Warning: The QCommonStyle {common styles} provided by Qt will respect this hint, because they call QStyle::proxy(), but there is no guarantee that QStyle::proxy() will be called for user defined or system controlled styles. It would not work on a Mac, for example, where menus are handled by the operating system.
Definition at line 56 of file qproxystyle.h.
QProxyStyle::QProxyStyle | ( | QStyle * | style = 0 | ) |
Constructs a QProxyStyle object for overriding behavior in style or in the current application style if style is 0 (default).
Normally style is 0, because you want to override behavior in the system style.
Ownership of style is transferred to QProxyStyle.
Definition at line 119 of file qproxystyle.cpp.
QProxyStyle::~QProxyStyle | ( | ) |
QStyle * QProxyStyle::baseStyle | ( | ) | const |
Returns the proxy base style object.
If no base style is set on the proxy style, QProxyStyle will create an instance of the application style instead.
Definition at line 144 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 195 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 186 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QStyle.
Definition at line 214 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QStyle.
Definition at line 204 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 176 of file qproxystyle.cpp.
|
protectedvirtual |
Reimplemented Function
Reimplemented from QObject.
Definition at line 367 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 304 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 268 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QStyle.
Definition at line 259 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QStyle.
Definition at line 250 of file qproxystyle.cpp.
|
protectedslot |
This slot is called by layoutSpacing() to determine the spacing that should be used between control1 and control2 in a layout.
orientation specifies whether the controls are laid out side by side or stacked vertically. The option parameter can be used to pass extra information about the parent widget. The widget parameter is optional and can also be used if option is 0.
The default implementation returns -1.
Definition at line 410 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 286 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 322 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 331 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 340 of file qproxystyle.cpp.
void QProxyStyle::setBaseStyle | ( | QStyle * | style | ) |
Sets the base style that should be proxied.
Ownership of style is transferred to QProxyStyle.
If style is zero, a desktop-dependant style will be assigned automatically.
Definition at line 159 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 223 of file qproxystyle.cpp.
|
protectedslot |
Returns an icon for the given standardIcon.
Reimplement this slot to provide your own icons in a QStyle subclass. The option argument can be used to pass extra information required to find the appropriate icon. The widget argument is optional and can also be used to help find the icon.
Definition at line 389 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QStyle.
Definition at line 313 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 295 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 277 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 241 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 232 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 349 of file qproxystyle.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QCommonStyle.
Definition at line 358 of file qproxystyle.cpp.