1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QPROXYSTYLE_H
5#define QPROXYSTYLE_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/QCommonStyle>
9
10QT_BEGIN_NAMESPACE
11
12
13#if !defined(QT_NO_STYLE_PROXY)
14
15class QProxyStylePrivate;
16class Q_WIDGETS_EXPORT QProxyStyle : public QCommonStyle
17{
18 Q_OBJECT
19
20public:
21 QProxyStyle(QStyle *style = nullptr);
22 QProxyStyle(const QString &key);
23 ~QProxyStyle();
24
25 QStyle *baseStyle() const;
26 void setBaseStyle(QStyle *style);
27
28 void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const override;
29 void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const override;
30 void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const override;
31 void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled,
32 const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const override;
33 virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const override;
34
35 QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override;
36
37 QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override;
38 QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override;
39 QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const override;
40 QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const override;
41
42 SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = nullptr) const override;
43 int styleHint(StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override;
44 int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override;
45 int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
46 Qt::Orientation orientation, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override;
47
48 QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override;
49 QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = nullptr) const override;
50 QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const override;
51 QPalette standardPalette() const override;
52
53 void polish(QWidget *widget) override;
54 void polish(QPalette &pal) override;
55 void polish(QApplication *app) override;
56
57 void unpolish(QWidget *widget) override;
58 void unpolish(QApplication *app) override;
59
60protected:
61 bool event(QEvent *e) override;
62
63private:
64 Q_DISABLE_COPY(QProxyStyle)
65 Q_DECLARE_PRIVATE(QProxyStyle)
66};
67
68#endif // QT_NO_STYLE_PROXY
69
70QT_END_NAMESPACE
71
72#endif // QPROXYSTYLE_H
73

source code of qtbase/src/widgets/styles/qproxystyle.h