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
9
class
MyColorPicker
:
public
QObject
10
{
11
Q_OBJECT
12
QML_ELEMENT
13
// Stores a value in the range [0, 1); myApp.qml type sets this with
14
// Math.random()
15
Q_PROPERTY
(
double
encodedColor
READ
encodedColor
WRITE
setEncodedColor
BINDABLE
bindableEncodedColor
)
16
17
QProperty
<
double
>
m_encodedColor
{0.5};
18
public
:
19
MyColorPicker
(QObject *parent =
nullptr
) :
QObject
(
parent
) {}
20
21
double
encodedColor
() {
return
m_encodedColor; }
22
void
setEncodedColor
(
double
value);
23
QBindable
<
double
>
bindableEncodedColor
();
24
25
// Returns a QColor "decoded" from encodedColor
26
Q_INVOKABLE QColor
decodeColor
();
27
};
MyColorPicker
Definition
colorpicker.h:10
MyColorPicker::encodedColor
double encodedColor()
Definition
colorpicker.h:21
MyColorPicker::encodedColor
QML_ELEMENTdouble encodedColor
Definition
colorpicker.h:15
MyColorPicker::MyColorPicker
MyColorPicker(QObject *parent=nullptr)
Definition
colorpicker.h:19
MyColorPicker::bindableEncodedColor
QBindable< double > bindableEncodedColor()
Definition
colorpicker.cpp:17
MyColorPicker::setEncodedColor
void setEncodedColor(double value)
Definition
colorpicker.cpp:8
qtdeclarative
src
qml
doc
snippets
qmltc
colorpicker.h
Generated on
for Qt by
1.14.0