1// Copyright (C) 2022 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 QQUICKABSTRACTCOLORPICKER_P_H
5#define QQUICKABSTRACTCOLORPICKER_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 <QtQuickTemplates2/private/qquickcontrol_p.h>
20
21#include "qtquickdialogs2quickimplglobal_p.h"
22
23QT_BEGIN_NAMESPACE
24
25class QQuickAbstractColorPickerPrivate;
26
27class Q_QUICKDIALOGS2QUICKIMPL_EXPORT QQuickAbstractColorPicker : public QQuickControl
28{
29 Q_OBJECT
30 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
31 Q_PROPERTY(qreal hue READ hue WRITE setHue NOTIFY colorChanged)
32 Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY colorChanged)
33 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY colorChanged)
34 Q_PROPERTY(qreal lightness READ lightness WRITE setLightness NOTIFY colorChanged)
35 Q_PROPERTY(qreal alpha READ alpha WRITE setAlpha NOTIFY colorChanged FINAL)
36 Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
37 Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
38 Q_PROPERTY(qreal implicitHandleWidth READ implicitHandleWidth NOTIFY implicitHandleWidthChanged FINAL)
39 Q_PROPERTY(qreal implicitHandleHeight READ implicitHandleHeight NOTIFY implicitHandleHeightChanged FINAL)
40 Q_CLASSINFO("DeferredPropertyNames", "background,contentItem,handle")
41 QML_NAMED_ELEMENT(AbstractColorPicker)
42 QML_ADDED_IN_VERSION(6, 4)
43 QML_UNCREATABLE("AbstractColorPicker is abstract.")
44
45public:
46 ~QQuickAbstractColorPicker() override;
47
48 QColor color() const;
49 void setColor(const QColor &c);
50
51 qreal hue() const;
52 void setHue(qreal hue);
53
54 qreal saturation() const;
55 void setSaturation(qreal saturation);
56
57 qreal value() const;
58 void setValue(qreal value);
59
60 qreal lightness() const;
61 void setLightness(qreal lightness);
62
63 qreal alpha() const;
64 void setAlpha(qreal alpha);
65
66 bool isPressed() const;
67 void setPressed(bool pressed);
68
69 QQuickItem *handle() const;
70 void setHandle(QQuickItem *handle);
71
72 qreal implicitHandleWidth() const;
73 qreal implicitHandleHeight() const;
74
75Q_SIGNALS:
76 void colorChanged(const QColor &color);
77 void pressedChanged();
78 void handleChanged();
79 void implicitHandleWidthChanged();
80 void implicitHandleHeightChanged();
81
82 void colorPicked(const QColor &color);
83
84protected:
85 QQuickAbstractColorPicker(QQuickAbstractColorPickerPrivate &dd, QQuickItem *parent);
86
87 virtual QColor colorAt(const QPointF &pos) = 0;
88 void componentComplete() override;
89
90private:
91 void updateColor(const QPointF &pos);
92 Q_DISABLE_COPY(QQuickAbstractColorPicker)
93 Q_DECLARE_PRIVATE(QQuickAbstractColorPicker)
94};
95
96QT_END_NAMESPACE
97
98#endif // QQUICKABSTRACTCOLORPICKER_P_H
99

source code of qtdeclarative/src/quickdialogs/quickdialogsquickimpl/qquickabstractcolorpicker_p.h