Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
colorpicker.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QtCore/qobject.h>
5#include <QtCore/qproperty.h>
6#include <QtQml/qqmlregistration.h>
7#include <QtGui/qcolor.h>
8
9class MyColorPicker : public QObject
10{
13 // Stores a value in the range [0, 1); myApp.qml type sets this with
14 // Math.random()
16
17 QProperty<double> m_encodedColor{0.5};
18public:
20
21 double encodedColor() { return m_encodedColor; }
22 void setEncodedColor(double value);
24
25 // Returns a QColor "decoded" from encodedColor
27};
double encodedColor()
Definition colorpicker.h:21
QML_ELEMENTdouble encodedColor
Definition colorpicker.h:15
MyColorPicker(QObject *parent=nullptr)
Definition colorpicker.h:19
Q_INVOKABLE QColor decodeColor()
QBindable< double > bindableEncodedColor()
void setEncodedColor(double value)
\inmodule QtCore
Definition qproperty.h:809
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
\inmodule QtCore
Definition qproperty.h:349
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define QML_ELEMENT
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE