2
* Copyright (c) 2008, Benjamin C. Meyer <ben@meyerhome.net>
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
7
* 1. Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* 2. Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
* 3. Neither the name of the Benjamin Meyer nor the names of its contributors
13
* may be used to endorse or promote products derived from this software
14
* without specific prior written permission.
16
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33
#include <qstylefactory.h>
36
A base class that can be used to write a style that modifise the currently style.
37
For more details see: http://doc.trolltech.com/qq/qq09-q-and-a.html#style
39
class ProxyStyle : public QStyle
44
explicit ProxyStyle(const QString &baseStyle)
46
style = QStyleFactory::create(baseStyle);
48
style = QStyleFactory::create(QLatin1String("windows"));
53
virtual void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const
54
{ style->drawComplexControl(control, option, painter, widget); }
55
virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const
56
{ style->drawControl(element, option, painter, widget); }
57
virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
58
{ style->drawItemPixmap(painter, rectangle, alignment, pixmap); }
59
virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const
60
{ style->drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole); }
61
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const
62
{ style->drawPrimitive(element, option, painter, widget); }
63
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
64
{ return style->generatedIconPixmap(iconMode, pixmap, option); }
65
virtual SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = 0) const
66
{ return style->hitTestComplexControl(control, option, position, widget); }
67
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
68
{ return style->itemPixmapRect(rectangle, alignment, pixmap); }
69
virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
70
{ return style->itemTextRect(metrics, rectangle, alignment, enabled, text); }
71
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const
72
{ return style->pixelMetric(metric, option, widget); }
73
virtual void polish(QWidget *widget)
74
{ style->polish(widget); }
75
virtual void polish(QApplication *application)
76
{ style->polish(application); }
77
virtual void polish(QPalette &palette)
78
{ style->polish(palette); }
79
virtual QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = 0) const
80
{ return style->sizeFromContents(type, option, contentsSize, widget); }
81
virtual QPalette standardPalette () const
82
{ return style->standardPalette(); }
83
virtual int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const
84
{ return style->styleHint(hint, option, widget, returnData); }
85
virtual QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget = 0) const
86
{ return style->subControlRect(control, option, subControl, widget); }
87
virtual void unpolish(QWidget *widget)
88
{ style->unpolish(widget); }
89
virtual void unpolish(QApplication *application)
90
{ style->unpolish(application); }
91
virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = 0, const QWidget *widget = 0) const
92
{ return style->standardPixmap(standardPixmap, opt, widget); }
93
virtual QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget = 0) const
94
{ return style->subElementRect(element, option, widget); }
95
virtual bool event(QEvent *e)
96
{ return style->event(e); }
97
virtual bool eventFilter(QObject *o, QEvent *e)
98
{ return style->eventFilter(o, e); }
101
int layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const
102
{ return style->layoutSpacing(control1, control2, orientation, option, widget); }
104
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option = 0, const QWidget *widget = 0) const
105
{ return style->standardIcon(standardIcon, option, widget); }
112
#endif // PROXYSTYLE_H