itom
Loading...
Searching...
No Matches
proxyStyle.h
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef PROXYSTYLE_H
22#define PROXYSTYLE_H
23
24// QT includes
25#include <QProxyStyle>
26
27// CTK includes
28#include "commonWidgets.h"
29
31
34
35class ITOMWIDGETS_EXPORT ProxyStyle : public QProxyStyle
36{
37 Q_OBJECT
38public:
39 ProxyStyle(QStyle *baseStyle = 0, QObject* parent = 0);
40 virtual ~ProxyStyle();
41
42 void ensureBaseStyle()const;
43
44 virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
45 virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
46 virtual void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const;
47 virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled,
48 const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
49 virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const;
50
51 virtual QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const;
52
53 virtual QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const;
54 virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const;
55 virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const;
56 virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
57
58 virtual SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const;
59 virtual int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const;
60 virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
61
62 virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const;
63 virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const;
64 virtual QPalette standardPalette() const;
65
66 virtual void polish(QWidget *widget);
67 virtual void polish(QPalette &pal);
68 virtual void polish(QApplication *app);
69
70 virtual void unpolish(QWidget *widget);
71 virtual void unpolish(QApplication *app);
72
73protected:
74 QScopedPointer<ProxyStylePrivate> d_ptr;
75 virtual bool event(QEvent *e);
76
77protected Q_SLOTS:
78 virtual QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
79 virtual int layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
80 Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const;
81private:
82 Q_DISABLE_COPY(ProxyStyle)
83 Q_DECLARE_PRIVATE(ProxyStyle)
84};
85
86#endif
Definition proxyStyle.h:36
Definition proxyStyle.cpp:41