1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtWidgets module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QCOMMONSTYLE_H
41 #define QCOMMONSTYLE_H
42 
43 #include <QtWidgets/qtwidgetsglobal.h>
44 #include <QtWidgets/qstyle.h>
45 
46 QT_BEGIN_NAMESPACE
47 
48 class QCommonStylePrivate;
49 
50 class Q_WIDGETS_EXPORT QCommonStyle: public QStyle
51 {
52     Q_OBJECT
53 
54 public:
55     QCommonStyle();
56     ~QCommonStyle();
57 
58     void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
59                        const QWidget *w = nullptr) const override;
60     void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
61                      const QWidget *w = nullptr) const override;
62     QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = nullptr) const override;
63     void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
64                             const QWidget *w = nullptr) const override;
65     SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
66                                      const QPoint &pt, const QWidget *w = nullptr) const override;
67     QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,
68                          const QWidget *w = nullptr) const override;
69     QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
70                            const QSize &contentsSize, const QWidget *widget = nullptr) const override;
71 
72     int pixelMetric(PixelMetric m, const QStyleOption *opt = nullptr, const QWidget *widget = nullptr) const override;
73 
74     int styleHint(StyleHint sh, const QStyleOption *opt = nullptr, const QWidget *w = nullptr,
75                   QStyleHintReturn *shret = nullptr) const override;
76 
77     QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt = nullptr,
78                        const QWidget *widget = nullptr) const override;
79     QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt = nullptr,
80                            const QWidget *widget = nullptr) const override;
81 
82     QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
83                                 const QStyleOption *opt) const override;
84     int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
85                       Qt::Orientation orientation, const QStyleOption *option = nullptr,
86                       const QWidget *widget = nullptr) const override;
87 
88     void polish(QPalette &) override;
89     void polish(QApplication *app) override;
90     void polish(QWidget *widget) override;
91     void unpolish(QWidget *widget) override;
92     void unpolish(QApplication *application) override;
93 
94 protected:
95     QCommonStyle(QCommonStylePrivate &dd);
96 
97 private:
98     Q_DECLARE_PRIVATE(QCommonStyle)
99     Q_DISABLE_COPY(QCommonStyle)
100 #if QT_CONFIG(animation)
101     Q_PRIVATE_SLOT(d_func(), void _q_removeAnimation())
102 #endif
103 };
104 
105 QT_END_NAMESPACE
106 
107 #endif // QCOMMONSTYLE_H
108