Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
colorpicker.cpp
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 "colorpicker.h"
5
6#include <QtCore/qlogging.h>
7
9{
10 if (value < 0.0 || !(value < 1.0)) {
11 qWarning("Bad value, %f, cannot get color from it!", value);
12 return;
13 }
14 m_encodedColor = value;
15}
16
18{
19 return QBindable<double>(&m_encodedColor);
20}
21
23{
24 const double encodedValue = m_encodedColor;
25 constexpr int rgbFirst = 0;
26 constexpr int rgbLast = 256 * 256 * 256;
27 const QRgb rgb = rgbFirst + (rgbLast - rgbFirst) * encodedValue;
28 return QColor(rgb);
29}
Q_INVOKABLE QColor decodeColor()
QBindable< double > bindableEncodedColor()
void setEncodedColor(double value)
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
#define rgb(r, g, b)
Definition qcolor.cpp:124
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qWarning
Definition qlogging.h:166
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition qrgb.h:13