6#include <QtCore/QRegularExpression>
27 m_hsva.
h =
qBound(.0,
c.hslHueF(), 1.0);
28 m_hsva.
s =
qBound(.0, sv.first, 1.0);
29 m_hsva.
v =
qBound(.0, sv.second, 1.0);
31 m_hsva.
h =
qBound(.0,
c.hsvHueF(), 1.0);
32 m_hsva.
s =
qBound(.0,
c.hsvSaturationF(), 1.0);
33 m_hsva.
v =
qBound(.0,
c.valueF(), 1.0);
36 m_hsva.
a =
c.alphaF();
111 disconnect(m_hexInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHexChanged);
116 connect(m_hexInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHexChanged);
132 disconnect(m_redInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleRedChanged);
137 connect(m_redInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleRedChanged);
153 disconnect(m_greenInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleGreenChanged);
158 connect(m_greenInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleGreenChanged);
174 disconnect(m_blueInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleBlueChanged);
179 connect(m_blueInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleBlueChanged);
186 return m_hsvHueInput;
195 disconnect(m_hsvHueInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHsvHueChanged);
200 connect(m_hsvHueInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHsvHueChanged);
207 return m_hslHueInput;
216 disconnect(m_hslHueInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHslHueChanged);
221 connect(m_hslHueInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHslHueChanged);
228 return m_hsvSaturationInput;
236 if (m_hsvSaturationInput)
237 disconnect(m_hsvSaturationInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHsvSaturationChanged);
241 if (m_hsvSaturationInput)
242 connect(m_hsvSaturationInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHsvSaturationChanged);
249 return m_hslSaturationInput;
257 if (m_hslSaturationInput)
258 disconnect(m_hslSaturationInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHslSaturationChanged);
262 if (m_hslSaturationInput)
263 connect(m_hslSaturationInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHslSaturationChanged);
279 disconnect(m_valueInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleValueChanged);
284 connect(m_valueInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleValueChanged);
291 return m_lightnessInput;
299 if (m_lightnessInput)
300 disconnect(m_lightnessInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleLightnessChanged);
304 if (m_lightnessInput)
305 connect(m_lightnessInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleLightnessChanged);
312 return m_rgbAlphaInput;
317 if (alphaInput == m_rgbAlphaInput)
320 if (m_rgbAlphaInput) {
321 disconnect(m_rgbAlphaInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleRgbAlphaChanged);
325 m_rgbAlphaInput = alphaInput;
327 if (m_rgbAlphaInput) {
328 connect(m_rgbAlphaInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleRgbAlphaChanged);
338 return m_hsvAlphaInput;
343 if (alphaInput == m_hsvAlphaInput)
346 if (m_hsvAlphaInput) {
347 disconnect(m_hsvAlphaInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHsvAlphaChanged);
351 m_hsvAlphaInput = alphaInput;
353 if (m_hsvAlphaInput) {
354 connect(m_hsvAlphaInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHsvAlphaChanged);
364 return m_hslAlphaInput;
369 if (alphaInput == m_hslAlphaInput)
372 if (m_hslAlphaInput) {
373 disconnect(m_hslAlphaInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHslAlphaChanged);
377 m_hslAlphaInput = alphaInput;
379 if (m_hslAlphaInput) {
380 connect(m_hslAlphaInput, &QQuickTextInput::editingFinished,
this, &QQuickColorInputs::handleHslAlphaChanged);
388void QQuickColorInputs::handleHexChanged()
393void QQuickColorInputs::handleRedChanged()
400void QQuickColorInputs::handleGreenChanged()
407void QQuickColorInputs::handleBlueChanged()
417void QQuickColorInputs::handleHsvHueChanged()
421 if (
match.hasMatch()) {
422 const auto substr =
match.captured(1);
428void QQuickColorInputs::handleHslHueChanged()
432 if (
match.hasMatch()) {
433 const auto substr =
match.captured(1);
439void QQuickColorInputs::handleHsvSaturationChanged()
443 if (
match.hasMatch()) {
444 const auto substr =
match.captured(1);
450void QQuickColorInputs::handleHslSaturationChanged()
454 if (
match.hasMatch()) {
455 const auto substr =
match.captured(1);
461void QQuickColorInputs::handleValueChanged()
465 if (
match.hasMatch()) {
466 const auto substr =
match.captured(1);
472void QQuickColorInputs::handleLightnessChanged()
476 if (
match.hasMatch()) {
477 const auto substr =
match.captured(1);
483void QQuickColorInputs::handleRgbAlphaChanged()
485 handleAlphaChanged(m_rgbAlphaInput->
text());
488void QQuickColorInputs::handleHsvAlphaChanged()
490 handleAlphaChanged(m_hsvAlphaInput->
text());
493void QQuickColorInputs::handleHslAlphaChanged()
495 handleAlphaChanged(m_hslAlphaInput->
text());
498void QQuickColorInputs::handleAlphaChanged(
const QString &
input)
502 if (
match.hasMatch()) {
504 const auto substr =
match.captured(1);
The QColor class provides colors based on RGB, HSV or CMYK values.
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...
QRgb rgba() const noexcept
Returns the RGB value of the color, including its alpha.
int red() const noexcept
Returns the red color component of this color.
static QColor fromString(QAnyStringView name) noexcept
int blue() const noexcept
Returns the blue color component of this color.
int green() const noexcept
Returns the green color component of this color.
static QColor fromHsvF(float h, float s, float v, float a=1.0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\inmodule QtCore \reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
int toInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Combined button and popup list for selecting options.
constexpr const T & qBound(const T &min, const T &val, const T &max)
GLenum GLenum GLenum input
std::pair< qreal, qreal > getSaturationAndLightness(qreal saturation, qreal value)
std::pair< qreal, qreal > getSaturationAndValue(qreal saturation, qreal lightness)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
myObject disconnect()
[26]