Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QCOLORDIALOG_H
6#define QCOLORDIALOG_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9
10#include <QtWidgets/qdialog.h>
11
13
14QT_BEGIN_NAMESPACE
15
16class QColorDialogPrivate;
17
18class Q_WIDGETS_EXPORT QColorDialog : public QDialog
19{
20 Q_OBJECT
21 Q_DECLARE_PRIVATE(QColorDialog)
22 Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor
23 NOTIFY currentColorChanged)
24 Q_PROPERTY(ColorDialogOptions options READ options WRITE setOptions)
25
26public:
27 enum ColorDialogOption {
28 ShowAlphaChannel = 0x00000001,
29 NoButtons = 0x00000002,
30 DontUseNativeDialog = 0x00000004,
31 NoEyeDropperButton = 0x00000008,
32 };
33 Q_ENUM(ColorDialogOption)
34
35 Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
36
37 explicit QColorDialog(QWidget *parent = nullptr);
38 explicit QColorDialog(const QColor &initial, QWidget *parent = nullptr);
39 ~QColorDialog();
40
41 void setCurrentColor(const QColor &color);
42 QColor currentColor() const;
43
44 QColor selectedColor() const;
45
46 void setOption(ColorDialogOption option, bool on = true);
47 bool testOption(ColorDialogOption option) const;
48 void setOptions(ColorDialogOptions options);
49 ColorDialogOptions options() const;
50
51 using QDialog::open;
52 void open(QObject *receiver, const char *member);
53
54 void setVisible(bool visible) override;
55
56 static QColor getColor(const QColor &initial = Qt::white,
57 QWidget *parent = nullptr,
58 const QString &title = QString(),
59 ColorDialogOptions options = ColorDialogOptions());
60
61 static int customCount();
62 static QColor customColor(int index);
63 static void setCustomColor(int index, QColor color);
64 static QColor standardColor(int index);
65 static void setStandardColor(int index, QColor color);
66
67Q_SIGNALS:
68 void currentColorChanged(const QColor &color);
69 void colorSelected(const QColor &color);
70
71protected:
72 void changeEvent(QEvent *event) override;
73 void done(int result) override;
74
75private:
76 Q_DISABLE_COPY(QColorDialog)
77};
78
79Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions)
80
81QT_END_NAMESPACE
82
83#endif // QCOLORDIALOG_H
QColor grabScreenColor(const QPoint &p)
bool selectColor(const QColor &color)
void init(const QColor &initial)
void setCurrentAlpha(int a)
QColorPickingEventFilter * colorPickingEventFilter
bool handleColorPickingMouseButtonRelease(QMouseEvent *e)
QColor currentQColor() const
bool handleColorPickingMouseMove(QMouseEvent *e)
void _q_setCustom(int index, QRgb color)
QPushButton * eyeDropperButton
void updateColorLabelText(const QPoint &)
void setCurrentColor(const QColor &color, SetColorMode setColorMode=SetColorAll)
bool isAlphaVisible() const
QVBoxLayout * leftLay
void setCurrentQColor(const QColor &color)
bool canBeNativeDialog() const override
void setCurrentRgbColor(QRgb rgb)
QRgb currentColor() const
void newColorTypedIn(QRgb rgb)
bool handleColorPickingKeyPress(QKeyEvent *e)
void updateColorPicking(const QPoint &pos)
QSharedPointer< QColorDialogOptions > options
void newStandard(int, int)
void setVisible(bool visible) override
QDialogButtonBox * buttons
bool supportsColorPicking() const
QPointer< QObject > receiverToDisconnectOnClose
virtual void initHelper(QPlatformDialogHelper *h) override
QByteArray memberToDisconnectOnClose
QPushButton * addCusBt
void newHsv(int h, int s, int v)
virtual void helperPrepareShow(QPlatformDialogHelper *h) override
QColorLuminancePicker * lp
void newCustom(int, int)
QPlatformColorDialogHelper * platformColorDialogHelper() const
void nextCustom(int, int)
The QColorDialog class provides a dialog widget for specifying colors.
friend class QPainter
\inmodule QtCore\reentrant
Definition qpoint.h:29
\variable QStyleOption::palette
\variable QStyleOptionFocusRect::backgroundColor
QColSpinBox(QWidget *parent)
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void mouseMoveEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
void mousePressEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void mouseMoveEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
QSize sizeHint() const override
void setCrossVisible(bool visible)
void resizeEvent(QResizeEvent *) override
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
void mousePressEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
bool eventFilter(QObject *, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void applicationStateChanged(Qt::ApplicationState state)
QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent)
void mouseReleaseEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
void mousePressEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void mouseMoveEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void setHsv(int h, int s, int v)
void currentColorChanged(const QColor &color)
QColorWell(QWidget *parent, int r, int c, const QRgb *vals)
void paintCellContents(QPainter *, int row, int col, const QRect &) override
void mousePressEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void mouseMoveEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
void mouseReleaseEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
friend class QT_PREPEND_NAMESPACE(QUntypedBindable)
void mouseReleaseEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
void focusOutEvent(QFocusEvent *) override
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) f...
void currentChanged(int row, int col)
int columnAt(int x) const
void updateCell(int row, int column)
void colorChanged(int index, QRgb color)
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void mousePressEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void focusInEvent(QFocusEvent *) override
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus receive...
virtual void setCurrent(int row, int col)
virtual void setSelected(int row, int col)
int rowAt(int y) const
QRect cellGeometry(int row, int column)
virtual void paintCell(QPainter *, int row, int col, const QRect &)
int columnX(int column) const
int rowY(int row) const
QSize sizeHint() const override
virtual void paintCellContents(QPainter *, int row, int col, const QRect &)
void keyPressEvent(QKeyEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive key press events f...
QString cellContent(int row, int col) const
QtPrivate::QColorShower QColorShower
static void rgb2hsv(QRgb rgb, int &h, int &s, int &v)
QtPrivate::QColorWell QColorWell
static int pHeight
QtPrivate::QWellArray QWellArray
static int pWidth
QtPrivate::QColorPickingEventFilter QColorPickingEventFilter
QtPrivate::QColorLuminancePicker QColorLuminancePicker
QtPrivate::QColorPicker QColorPicker
static const Qt::WindowFlags qcd_DefaultWindowFlags
@ colorColumns
@ standardColorRows
@ customColorRows
QT_REQUIRE_CONFIG(colordialog)
#define qApp