Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwidgetplatformcolordialog.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
6
7#include <QtWidgets/qcolordialog.h>
8
10
12 : m_dialog(new QColorDialog)
13{
15
19}
20
22{
23}
24
26{
27 return m_dialog->currentColor();
28}
29
31{
32 m_dialog->setCurrentColor(color);
33}
34
36{
37 m_dialog->exec();
38}
39
41{
43 m_dialog->setWindowTitle(options->windowTitle());
44 m_dialog->setOptions(static_cast<QColorDialog::ColorDialogOptions>(int(options->options())) | QColorDialog::DontUseNativeDialog);
45
46 return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
47}
48
50{
51 m_dialog->hide();
52}
53
55
56#include "moc_qwidgetplatformcolordialog_p.cpp"
The QColorDialog class provides a dialog widget for specifying colors.
QColor currentColor
the currently selected color in the dialog
void setCurrentColor(const QColor &color)
void currentColorChanged(const QColor &color)
This signal is emitted whenever the current color changes in the dialog.
void setOptions(ColorDialogOptions options)
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
void rejected()
virtual int exec()
Shows the dialog as a \l{QDialog::Modal Dialogs}{modal dialog}, blocking until the user closes it.
Definition qdialog.cpp:539
void accepted()
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
void setParent(QObject *parent)
Makes the object a child of parent.
Definition qobject.cpp:2142
virtual void setCurrentColor(const QColor &)=0
const QSharedPointer< QColorDialogOptions > & options() const
void currentColorChanged(const QColor &color)
virtual QColor currentColor() const =0
virtual void exec()=0
virtual void hide()=0
virtual bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)=0
T * data() const noexcept
Returns the value of the pointer referenced by this object.
\inmodule QtCore
QWidgetPlatformColorDialog(QObject *parent=nullptr)
static bool show(QDialog *dialog, Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
void hide()
Hides the widget.
Definition qwidget.cpp:8209
void setWindowTitle(const QString &)
Definition qwidget.cpp:6109
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
WindowModality
GLbitfield flags
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent