Qt 6.x
The Qt SDK
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 Q_PRIVATE_SLOT(d_func(), void _q_addCustom())
78 Q_PRIVATE_SLOT(d_func(), void _q_newHsv(int h, int s, int v))
79 Q_PRIVATE_SLOT(d_func(), void _q_newColorTypedIn(QRgb rgb))
80 Q_PRIVATE_SLOT(d_func(), void _q_nextCustom(int, int))
81 Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int))
82 Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int))
83 Q_PRIVATE_SLOT(d_func(), void _q_pickScreenColor())
84 Q_PRIVATE_SLOT(d_func(), void _q_updateColorPicking())
85};
86
88
90
91#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 done(int)
Closes the dialog and sets its result code to r.
Definition qdialog.cpp:598
virtual void open()
Definition qdialog.cpp:499
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtCore
Definition qobject.h:90
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
virtual void setVisible(bool visible)
Definition qwidget.cpp:8329
virtual void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition qwidget.cpp:9428
Combined button and popup list for selecting options.
@ white
Definition qnamespace.h:30
#define rgb(r, g, b)
Definition qcolor.cpp:124
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLsizei const GLfloat * v
[13]
GLuint index
[2]
GLfloat GLfloat GLfloat GLfloat h
struct _cl_event * event
GLuint64EXT * result
[6]
GLdouble s
[6]
Definition qopenglext.h:235
GLuint GLenum option
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition qrgb.h:13
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
QString title
[35]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent