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
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:
19 MyColorPicker(QObject *parent = nullptr) : QObject(parent) {}
20
21 double encodedColor() { return m_encodedColor; }
22 void setEncodedColor(double value);
24
25 // Returns a QColor "decoded" from encodedColor
26 Q_INVOKABLE QColor decodeColor();
27};
double encodedColor()
Definition colorpicker.h:21
QML_ELEMENTdouble encodedColor
Definition colorpicker.h:15
MyColorPicker(QObject *parent=nullptr)
Definition colorpicker.h:19
QBindable< double > bindableEncodedColor()
void setEncodedColor(double value)