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 QQUICKCOLORDIALOGIMPL_P_H
5#define QQUICKCOLORDIALOGIMPL_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 <QtQuickTemplates2/private/qquickdialog_p.h>
19
20#include "qtquickdialogs2quickimplglobal_p.h"
21
22QT_BEGIN_NAMESPACE
23
24class QQuickDialogButtonBox;
25class QQuickAbstractColorPicker;
26class QQuickColorInputs;
27class QQuickSlider;
28
29class QQuickColorDialogImplAttached;
30class QQuickColorDialogImplAttachedPrivate;
31class QQuickColorDialogImplPrivate;
32
33class Q_QUICKDIALOGS2QUICKIMPL_PRIVATE_EXPORT QQuickColorDialogImpl : public QQuickDialog
34{
35 Q_OBJECT
36 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
37 Q_PROPERTY(qreal hue READ hue WRITE setHue NOTIFY colorChanged)
38 Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY colorChanged)
39 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY colorChanged)
40 Q_PROPERTY(qreal lightness READ lightness WRITE setLightness NOTIFY colorChanged)
41 Q_PROPERTY(qreal alpha READ alpha WRITE setAlpha NOTIFY colorChanged FINAL)
42 Q_PROPERTY(int red READ red WRITE setRed NOTIFY colorChanged FINAL)
43 Q_PROPERTY(int green READ green WRITE setGreen NOTIFY colorChanged FINAL)
44 Q_PROPERTY(int blue READ blue WRITE setBlue NOTIFY colorChanged FINAL)
45 Q_PROPERTY(bool isHsl READ isHsl WRITE setHsl NOTIFY specChanged FINAL)
46 QML_NAMED_ELEMENT(ColorDialogImpl)
47 QML_ATTACHED(QQuickColorDialogImplAttached)
48 QML_ADDED_IN_VERSION(6, 4)
49
50public:
51 explicit QQuickColorDialogImpl(QObject *parent = nullptr);
52
53 static QQuickColorDialogImplAttached *qmlAttachedProperties(QObject *object);
54
55 QSharedPointer<QColorDialogOptions> options() const;
56 void setOptions(const QSharedPointer<QColorDialogOptions> &options);
57
58 QColor color() const;
59 void setColor(const QColor &c);
60
61 int red() const;
62 void setRed(int red);
63
64 int green() const;
65 void setGreen(int green);
66
67 int blue() const;
68 void setBlue(int blue);
69
70 qreal alpha() const;
71 void setAlpha(qreal alpha);
72
73 qreal hue() const;
74 void setHue(qreal hue);
75
76 qreal saturation() const;
77 void setSaturation(qreal saturation);
78
79 qreal value() const;
80 void setValue(qreal value);
81
82 qreal lightness() const;
83 void setLightness(qreal lightness);
84
85 bool isHsl() const;
86 void setHsl(bool hsl);
87
88 Q_INVOKABLE void invokeEyeDropper();
89
90Q_SIGNALS:
91 void colorChanged(const QColor &color);
92 void specChanged();
93
94private:
95 Q_DISABLE_COPY(QQuickColorDialogImpl)
96 Q_DECLARE_PRIVATE(QQuickColorDialogImpl)
97};
98
99class Q_QUICKDIALOGS2QUICKIMPL_PRIVATE_EXPORT QQuickColorDialogImplAttached : public QObject
100{
101 Q_OBJECT
102 Q_PROPERTY(QQuickDialogButtonBox *buttonBox READ buttonBox WRITE setButtonBox NOTIFY buttonBoxChanged FINAL)
103 Q_PROPERTY(QQuickAbstractButton *eyeDropperButton READ eyeDropperButton WRITE setEyeDropperButton NOTIFY eyeDropperButtonChanged FINAL)
104 Q_PROPERTY(QQuickAbstractColorPicker *colorPicker READ colorPicker WRITE setColorPicker NOTIFY
105 colorPickerChanged FINAL)
106 Q_PROPERTY(QQuickColorInputs *colorInputs READ colorInputs WRITE setColorInputs NOTIFY
107 colorInputsChanged FINAL)
108 Q_PROPERTY(QQuickSlider *alphaSlider READ alphaSlider WRITE setAlphaSlider NOTIFY
109 alphaSliderChanged FINAL)
110 Q_MOC_INCLUDE(<QtQuickTemplates2/private/qquickdialogbuttonbox_p.h>)
111 Q_MOC_INCLUDE(<QtQuickTemplates2/private/qquickabstractbutton_p.h>)
112 Q_MOC_INCLUDE(<QtQuickTemplates2/private/qquickslider_p.h>)
113 Q_MOC_INCLUDE("qquickabstractcolorpicker_p.h")
114 Q_MOC_INCLUDE("qquickcolorinputs_p.h")
115
116public:
117 explicit QQuickColorDialogImplAttached(QObject *parent = nullptr);
118
119 QQuickDialogButtonBox *buttonBox() const;
120 void setButtonBox(QQuickDialogButtonBox *buttonBox);
121
122 QQuickAbstractButton *eyeDropperButton() const;
123 void setEyeDropperButton(QQuickAbstractButton *eyeDropperButton);
124
125 QQuickAbstractColorPicker *colorPicker() const;
126 void setColorPicker(QQuickAbstractColorPicker *colorPicker);
127
128 QQuickColorInputs *colorInputs() const;
129 void setColorInputs(QQuickColorInputs *colorInputs);
130
131 QQuickSlider *alphaSlider() const;
132 void setAlphaSlider(QQuickSlider *alphaSlider);
133
134Q_SIGNALS:
135 void buttonBoxChanged();
136 void eyeDropperButtonChanged();
137 void colorPickerChanged();
138 void colorInputsChanged();
139 void alphaSliderChanged();
140
141private:
142 Q_DISABLE_COPY(QQuickColorDialogImplAttached)
143 Q_DECLARE_PRIVATE(QQuickColorDialogImplAttached)
144};
145
146QT_END_NAMESPACE
147
148QML_DECLARE_TYPE(QQuickColorDialogImpl)
149
150#endif // QQUICKCOLORDIALOGIMPL_P_H
151

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