9#include <QtQuickTemplates2/private/qquickslider_p.h>
11#include <qpa/qplatformintegration.h>
12#include <private/qguiapplication_p.h>
30 switch (
event->type()) {
32 m_lastPosition =
static_cast<QMouseEvent *
>(
event)->globalPosition().toPoint();
33 m_update(m_lastPosition);
37 m_lastPosition =
static_cast<QMouseEvent *
>(
event)->globalPosition().toPoint();
45#if QT_CONFIG(shortcut)
74 const auto c =
q->color();
86 qmlAttachedPropertiesObject<QQuickColorDialogImpl>(
q,
false));
88 qmlWarning(
q) <<
"Expected ColorDialogImpl attached object to be present on" <<
this;
100 qWarning() <<
"No window found, cannot enter eyeDropperMode.";
134 qWarning() <<
"Window not set, cannot leave eyeDropperMode.";
141 q->setColor(colorToUse);
163 q->setAlpha(attached->alphaSlider()->value());
193 d->m_hsva.h =
qBound(.0,
c.hsvHueF(), 1.0);
196 d->m_hsva.s =
qBound(.0, sl.first, 1.0);
197 d->m_hsva.l =
qBound(.0, sl.second, 1.0);
199 d->m_hsva.s =
qBound(.0,
c.hsvSaturationF(), 1.0);
200 d->m_hsva.v =
qBound(.0,
c.valueF(), 1.0);
203 d->m_hsva.h =
qBound(.0,
c.hslHueF(), 1.0);
205 d->m_hsva.s =
qBound(.0,
c.hslSaturationF(), 1.0);
206 d->m_hsva.l =
qBound(.0,
c.lightnessF(), 1.0);
209 d->m_hsva.s =
qBound(.0, sv.first, 1.0);
210 d->m_hsva.v =
qBound(.0, sv.second, 1.0);
213 d->m_hsva.h =
qBound(.0,
d->m_hsl ?
c.hslHueF() :
c.hsvHueF(), 1.0);
214 d->m_hsva.s =
qBound(.0,
d->m_hsl ?
c.hslSaturationF() :
c.hsvSaturationF(), 1.0);
215 d->m_hsva.v =
qBound(.0,
d->m_hsl ?
c.lightnessF() :
c.valueF(), 1.0);
218 d->m_hsva.a =
c.alphaF();
239 d->m_hsva.h =
d->m_hsl ?
c.hslHueF() :
c.hsvHueF();
240 d->m_hsva.s =
d->m_hsl ?
c.hslSaturationF() :
c.hsvSaturationF();
241 d->m_hsva.v =
d->m_hsl ?
c.lightnessF() :
c.valueF();
242 d->m_hsva.a =
c.alphaF();
263 d->m_hsva.h =
d->m_hsl ?
c.hslHueF() :
c.hsvHueF();
264 d->m_hsva.s =
d->m_hsl ?
c.hslSaturationF() :
c.hsvSaturationF();
265 d->m_hsva.v =
d->m_hsl ?
c.lightnessF() :
c.valueF();
266 d->m_hsva.a =
c.alphaF();
282 if (
c.blue() ==
blue)
287 d->m_hsva.h =
d->m_hsl ?
c.hslHueF() :
c.hsvHueF();
288 d->m_hsva.s =
d->m_hsl ?
c.hslSaturationF() :
c.hsvSaturationF();
289 d->m_hsva.v =
d->m_hsl ?
c.lightnessF() :
c.valueF();
290 d->m_hsva.a =
c.alphaF();
428 const bool noEyeDropperButton = (
d->options &&
d->options->options() & QColorDialogOptions::NoEyeDropperButton);
433 !(
d->options->options() & QColorDialogOptions::NoButtons));
435 const bool showAlpha =
d->options->options() & QColorDialogOptions::ShowAlphaChannel;
445 d->eyeDropperEnter();
451 if (!qobject_cast<QQuickColorDialogImpl *>(
parent)) {
452 qmlWarning(
this) <<
"ColorDialogImpl attached properties should only be "
453 <<
"accessed through the root ColorDialogImpl instance";
471 if (colorDialogImpl) {
486 if (colorDialogImpl) {
503 return d->eyeDropperButton;
514 if (
auto dialog = qobject_cast<QQuickColorDialogImpl *>(
parent()))
522 return d->colorPicker;
530 if (
d->colorPicker) {
532 if (colorDialogImpl) {
540 if (
d->colorPicker) {
542 if (colorDialogImpl) {
554 return d->alphaSlider;
563 if (
d->alphaSlider) {
565 if (colorDialogImpl) {
574 if (
d->alphaSlider) {
576 if (colorDialogImpl) {
589 return d->colorInputs;
599 if (
d->colorInputs) {
608 if (
d->colorInputs) {
int compare(QByteArrayView a, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
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.
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 QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
static QPlatformIntegration * platformIntegration()
QScreen * primaryScreen
the primary (or default) screen of the application.
static void setOverrideCursor(const QCursor &)
Sets the application override cursor to cursor.
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
static QScreen * screenAt(const QPoint &point)
Returns the screen at point, or \nullptr if outside of any screen.
The QKeyEvent class describes a key event.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
bool isNull() const
Returns true if the referenced object has been destroyed or if there is no referenced object; otherwi...
void colorPicked(const QColor &color)
void colorPickerChanged()
void eyeDropperButtonChanged()
QQuickColorInputs * colorInputs
void alphaSliderChanged()
void setButtonBox(QQuickDialogButtonBox *buttonBox)
void setEyeDropperButton(QQuickAbstractButton *eyeDropperButton)
QQuickColorDialogImplAttached(QObject *parent=nullptr)
void colorInputsChanged()
QQuickSlider * alphaSlider
QQuickAbstractButton * eyeDropperButton
void setColorInputs(QQuickColorInputs *colorInputs)
void setColorPicker(QQuickAbstractColorPicker *colorPicker)
QQuickAbstractColorPicker * colorPicker
QQuickDialogButtonBox * buttonBox
void setAlphaSlider(QQuickSlider *alphaSlider)
std::unique_ptr< QQuickEyeDropperEventFilter > eyeDropperEventFilter
void eyeDropperLeave(const QPoint &pos, QQuickEyeDropperEventFilter::LeaveReason actionOnLeave)
void handleClick(QQuickAbstractButton *button) override
QColor m_eyeDropperPreviousColor
~QQuickColorDialogImplPrivate()
static QQuickColorDialogImplPrivate * get(QQuickColorDialogImpl *dialog)
QQuickColorDialogImplAttached * attachedOrWarn()
QQuickColorDialogImplPrivate()
void eyeDropperPointerMoved(const QPoint &pos)
QPointer< QQuickWindow > m_eyeDropperWindow
void setValue(qreal value)
Q_INVOKABLE void invokeEyeDropper()
void setLightness(qreal lightness)
QQuickColorDialogImpl(QObject *parent=nullptr)
void setOptions(const QSharedPointer< QColorDialogOptions > &options)
QSharedPointer< QColorDialogOptions > options() const
static QQuickColorDialogImplAttached * qmlAttachedProperties(QObject *object)
void setAlpha(qreal alpha)
void colorChanged(const QColor &color)
void setSaturation(qreal saturation)
void setColor(const QColor &c)
virtual void handleClick(QQuickAbstractButton *button)
static QQuickDialogPrivate * get(QQuickDialog *dialog)
virtual void handleAccept()
static QPlatformDialogHelper::ButtonRole buttonRole(QQuickAbstractButton *button)
Popup dialog with standard buttons and a title, used for short-term interaction with the user.
virtual void handleReject()
bool eventFilter(QObject *obj, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
The QScreen class is used to query screen properties. \inmodule QtGui.
QRect geometry
the screen's geometry in pixels
QPixmap grabWindow(WId window=0, int x=0, int y=0, int w=-1, int h=-1)
Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by Q...
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
constexpr const T & qBound(const T &min, const T &val, const T &max)
static Q_DECL_CONST_FUNCTION bool qt_is_finite(double d)
GLdouble GLdouble GLdouble GLdouble q
GLfloat GLfloat GLfloat alpha
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QT_BEGIN_NAMESPACE QColor grabScreenColor(const QPoint &p)
std::pair< qreal, qreal > getSaturationAndLightness(qreal saturation, qreal value)
std::pair< qreal, qreal > getSaturationAndValue(qreal saturation, qreal lightness)
QLatin1StringView QLatin1String
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QFileDialog dialog(this)
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent