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
qquicklabsplatformcolordialog.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 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
5
7
12
63
78{
79 return m_color;
80}
81
83{
84 if (m_color == color)
85 return;
86
87 m_color = color;
90}
91
104{
105 if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(handle()))
106 return colorDialog->currentColor();
107 return m_currentColor;
108}
109
111{
112 if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(handle()))
113 colorDialog->setCurrentColor(color);
114 m_currentColor = color;
115}
116
132QColorDialogOptions::ColorDialogOptions QQuickLabsPlatformColorDialog::options() const
133{
134 return m_options->options();
135}
136
137void QQuickLabsPlatformColorDialog::setOptions(QColorDialogOptions::ColorDialogOptions options)
138{
139 if (options == m_options->options())
140 return;
141
142 m_options->setOptions(options);
144}
145
147{
149 && !m_options->testOption(QColorDialogOptions::DontUseNativeDialog);
150}
151
153{
154 if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(dialog)) {
156 colorDialog->setOptions(m_options);
157 colorDialog->setCurrentColor(m_currentColor);
158 }
159}
160
162{
163 m_options->setWindowTitle(title());
164 if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(dialog))
165 colorDialog->setOptions(m_options);
166}
167
173
175
176#include "moc_qquicklabsplatformcolordialog_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
The QPlatformColorDialogHelper class allows for platform-specific customization of color dialogs.
void currentColorChanged(const QColor &color)
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
The QPlatformTheme class allows customizing the UI based on themes.
QColorDialogOptions::ColorDialogOptions options
void accept() override
\qmlmethod void Qt.labs.platform::Dialog::accept()
void onCreate(QPlatformDialogHelper *dialog) override
void onShow(QPlatformDialogHelper *dialog) override
QQuickLabsPlatformColorDialog(QObject *parent=nullptr)
A native color dialog.
void setOptions(QColorDialogOptions::ColorDialogOptions options)
QPlatformDialogHelper * handle() const
virtual void accept()
\qmlmethod void Qt.labs.platform::Dialog::accept()
Combined button and popup list for selecting options.
SharedPointerFileDialogOptions m_options
GLuint color
[2]
#define emit
QFileDialog dialog(this)
[1]
view create()