Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickabstractcolorpicker_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKABSTRACTCOLORPICKER_P_H
6#define QQUICKABSTRACTCOLORPICKER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtGui/qcolor.h>
20#include <QtQuickTemplates2/private/qquickcontrol_p.h>
21
23
24QT_BEGIN_NAMESPACE
25
26class QQuickAbstractColorPickerPrivate;
27
28class Q_QUICKDIALOGS2QUICKIMPL_EXPORT QQuickAbstractColorPicker : public QQuickControl
29{
30 Q_OBJECT
31 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
32 Q_PROPERTY(qreal hue READ hue WRITE setHue NOTIFY colorChanged)
33 Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY colorChanged)
34 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY colorChanged)
35 Q_PROPERTY(qreal lightness READ lightness WRITE setLightness NOTIFY colorChanged)
36 Q_PROPERTY(qreal alpha READ alpha WRITE setAlpha NOTIFY colorChanged FINAL)
37 Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
38 Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
39 Q_PROPERTY(qreal implicitHandleWidth READ implicitHandleWidth NOTIFY implicitHandleWidthChanged FINAL)
40 Q_PROPERTY(qreal implicitHandleHeight READ implicitHandleHeight NOTIFY implicitHandleHeightChanged FINAL)
41 Q_CLASSINFO("DeferredPropertyNames", "background,contentItem,handle")
42 QML_NAMED_ELEMENT(AbstractColorPicker)
43 QML_ADDED_IN_VERSION(6, 4)
44 QML_UNCREATABLE("AbstractColorPicker is abstract.")
45
46public:
47 ~QQuickAbstractColorPicker() override;
48
49 QColor color() const;
50 void setColor(const QColor &c);
51
52 qreal hue() const;
53 void setHue(qreal hue);
54
55 qreal saturation() const;
56 void setSaturation(qreal saturation);
57
58 qreal value() const;
59 void setValue(qreal value);
60
61 qreal lightness() const;
62 void setLightness(qreal lightness);
63
64 qreal alpha() const;
65 void setAlpha(qreal alpha);
66
67 bool isPressed() const;
68 void setPressed(bool pressed);
69
70 QQuickItem *handle() const;
71 void setHandle(QQuickItem *handle);
72
73 qreal implicitHandleWidth() const;
74 qreal implicitHandleHeight() const;
75
76Q_SIGNALS:
77 void colorChanged(const QColor &color);
78 void pressedChanged();
79 void handleChanged();
80 void implicitHandleWidthChanged();
81 void implicitHandleHeightChanged();
82
83 void colorPicked(const QColor &color);
84
85protected:
86 QQuickAbstractColorPicker(QQuickAbstractColorPickerPrivate &dd, QQuickItem *parent);
87
88 virtual QColor colorAt(const QPointF &pos) = 0;
89 void componentComplete() override;
90
91private:
92 void updateColor(const QPointF &pos);
93 Q_DISABLE_COPY(QQuickAbstractColorPicker)
94 Q_DECLARE_PRIVATE(QQuickAbstractColorPicker)
95};
96
97QT_END_NAMESPACE
98
99#endif // QQUICKABSTRACTCOLORPICKER_P_H
bool handleRelease(const QPointF &point, ulong timestamp) override
void itemImplicitHeightChanged(QQuickItem *item) override
QQuickDeferredPointer< QQuickItem > m_handle
void itemImplicitWidthChanged(QQuickItem *item) override
bool handlePress(const QPointF &point, ulong timestamp) override
static QQuickAbstractColorPickerPrivate * get(QQuickAbstractColorPicker *colorPicker)
bool handleMove(const QPointF &point, ulong timestamp) override