1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
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_PRIVATE_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 QColor color() const;
47 void setColor(const QColor &c);
48
49 qreal hue() const;
50 void setHue(qreal hue);
51
52 qreal saturation() const;
53 void setSaturation(qreal saturation);
54
55 qreal value() const;
56 void setValue(qreal value);
57
58 qreal lightness() const;
59 void setLightness(qreal lightness);
60
61 qreal alpha() const;
62 void setAlpha(qreal alpha);
63
64 bool isPressed() const;
65 void setPressed(bool pressed);
66
67 QQuickItem *handle() const;
68 void setHandle(QQuickItem *handle);
69
70 qreal implicitHandleWidth() const;
71 qreal implicitHandleHeight() const;
72
73Q_SIGNALS:
74 void colorChanged(const QColor &color);
75 void pressedChanged();
76 void handleChanged();
77 void implicitHandleWidthChanged();
78 void implicitHandleHeightChanged();
79
80 void colorPicked(const QColor &color);
81
82protected:
83 QQuickAbstractColorPicker(QQuickAbstractColorPickerPrivate &dd, QQuickItem *parent);
84
85 virtual QColor colorAt(const QPointF &pos) = 0;
86 void componentComplete() override;
87
88private:
89 void updateColor(const QPointF &pos);
90 Q_DISABLE_COPY(QQuickAbstractColorPicker)
91 Q_DECLARE_PRIVATE(QQuickAbstractColorPicker)
92};
93
94QT_END_NAMESPACE
95
96#endif // QQUICKABSTRACTCOLORPICKER_P_H
97

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