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
qquicksaturationlightnesspicker.cpp
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
6
7#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
8#include <QtQuickTemplates2/private/qquickdeferredexecute_p_p.h>
9
11
23
28
30{
31 const qreal w = width();
32 const qreal h = height();
33 if (w <= 0 || h <= 0)
34 return color();
35 const qreal x = qBound(.0, pos.x(), w);
36 const qreal y = qBound(.0, pos.y(), h);
37 const qreal saturation = 1.0 - (y / h);
38 const qreal lightness = x / w;
39
41}
42
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
static QColor fromHslF(float h, float s, float l, float a=1.0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qcolor.cpp:2594
\inmodule QtCore\reentrant
Definition qpoint.h:217
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
qreal width
This property holds the width of this item.
Definition qquickitem.h:75
qreal height
This property holds the height of this item.
Definition qquickitem.h:76
QColor colorAt(const QPointF &pos) override
QQuickSaturationLightnessPicker(QQuickItem *parent=nullptr)
Combined button and popup list for selecting options.
constexpr const T & qBound(const T &min, const T &val, const T &max)
Definition qminmax.h:44
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint y
GLfloat GLfloat GLfloat GLfloat h
double qreal
Definition qtypes.h:187