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
qcolordialog.h
Go to the documentation of this file.
1// Copyright (C) 2016 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
4#ifndef QCOLORDIALOG_H
5#define QCOLORDIALOG_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8
9#include <QtWidgets/qdialog.h>
10
11QT_REQUIRE_CONFIG(colordialog);
12
14
16
17class Q_WIDGETS_EXPORT QColorDialog : public QDialog
18{
20 Q_DECLARE_PRIVATE(QColorDialog)
21 Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor
22 NOTIFY currentColorChanged)
23 Q_PROPERTY(ColorDialogOptions options READ options WRITE setOptions)
24
25public:
27 ShowAlphaChannel = 0x00000001,
28 NoButtons = 0x00000002,
29 DontUseNativeDialog = 0x00000004,
30 NoEyeDropperButton = 0x00000008,
31 };
32 Q_ENUM(ColorDialogOption)
33
34 Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
35
36 explicit QColorDialog(QWidget *parent = nullptr);
37 explicit QColorDialog(const QColor &initial, QWidget *parent = nullptr);
39
40 void setCurrentColor(const QColor &color);
41 QColor currentColor() const;
42
43 QColor selectedColor() const;
44
45 void setOption(ColorDialogOption option, bool on = true);
46 bool testOption(ColorDialogOption option) const;
47 void setOptions(ColorDialogOptions options);
48 ColorDialogOptions options() const;
49
50 using QDialog::open;
51 void open(QObject *receiver, const char *member);
52
53 void setVisible(bool visible) override;
54
55 static QColor getColor(const QColor &initial = Qt::white,
56 QWidget *parent = nullptr,
57 const QString &title = QString(),
58 ColorDialogOptions options = ColorDialogOptions());
59
60 static int customCount();
61 static QColor customColor(int index);
62 static void setCustomColor(int index, QColor color);
63 static QColor standardColor(int index);
64 static void setStandardColor(int index, QColor color);
65
69
70protected:
71 void changeEvent(QEvent *event) override;
72 void done(int result) override;
73
74private:
75 Q_DISABLE_COPY(QColorDialog)
76};
77
78Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions)
79
81
82#endif // QCOLORDIALOG_H
The QColorDialog class provides a dialog widget for specifying colors.
void currentColorChanged(const QColor &color)
This signal is emitted whenever the current color changes in the dialog.
void colorSelected(const QColor &color)
This signal is emitted just after the user has clicked \uicontrol{OK} to select a color to use.
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
The QDialog class is the base class of dialog windows.
Definition qdialog.h:19
virtual void open()
Definition qdialog.cpp:503
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtCore
Definition qobject.h:103
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
Combined button and popup list for selecting options.
@ white
Definition qnamespace.h:31
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLuint index
[2]
GLuint color
[2]
struct _cl_event * event
GLuint64EXT * result
[6]
GLuint GLenum option
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SIGNALS
file open(QIODevice::ReadOnly)
QString title
[35]