1 | // Copyright (C) 2017 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 QQUICKCOLORIMAGE_P_H |
5 | #define QQUICKCOLORIMAGE_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtGui/qcolor.h> |
19 | #include <QtQuick/private/qquickimage_p.h> |
20 | #include <QtQuickControls2Impl/private/qtquickcontrols2implglobal_p.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class Q_QUICKCONTROLS2IMPL_PRIVATE_EXPORT QQuickColorImage : public QQuickImage |
25 | { |
26 | Q_OBJECT |
27 | Q_PROPERTY(QColor color READ color WRITE setColor RESET resetColor NOTIFY colorChanged FINAL) |
28 | Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor RESET resetDefaultColor NOTIFY defaultColorChanged FINAL) |
29 | QML_NAMED_ELEMENT(ColorImage) |
30 | QML_ADDED_IN_VERSION(2, 3) |
31 | |
32 | public: |
33 | explicit QQuickColorImage(QQuickItem *parent = nullptr); |
34 | |
35 | QColor color() const; |
36 | void setColor(const QColor &color); |
37 | void resetColor(); |
38 | |
39 | QColor defaultColor() const; |
40 | void setDefaultColor(const QColor &color); |
41 | void resetDefaultColor(); |
42 | |
43 | Q_SIGNALS: |
44 | void colorChanged(); |
45 | void defaultColorChanged(); |
46 | |
47 | protected: |
48 | void pixmapChange() override; |
49 | |
50 | private: |
51 | QColor m_color = Qt::transparent; |
52 | QColor m_defaultColor = Qt::transparent; |
53 | }; |
54 | |
55 | QT_END_NAMESPACE |
56 | |
57 | #endif // QQUICKCOLORIMAGE_P_H |
58 | |