Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qcolordialog.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QCOLORDIALOG_H
0006 #define QCOLORDIALOG_H
0007 
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 
0010 #include <QtWidgets/qdialog.h>
0011 
0012 QT_REQUIRE_CONFIG(colordialog);
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 class QColorDialogPrivate;
0017 
0018 class Q_WIDGETS_EXPORT QColorDialog : public QDialog
0019 {
0020     Q_OBJECT
0021     Q_DECLARE_PRIVATE(QColorDialog)
0022     Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor
0023                NOTIFY currentColorChanged)
0024     Q_PROPERTY(ColorDialogOptions options READ options WRITE setOptions)
0025 
0026 public:
0027     enum ColorDialogOption {
0028         ShowAlphaChannel    = 0x00000001,
0029         NoButtons           = 0x00000002,
0030         DontUseNativeDialog = 0x00000004,
0031         NoEyeDropperButton  = 0x00000008,
0032     };
0033     Q_ENUM(ColorDialogOption)
0034 
0035     Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
0036 
0037     explicit QColorDialog(QWidget *parent = nullptr);
0038     explicit QColorDialog(const QColor &initial, QWidget *parent = nullptr);
0039     ~QColorDialog();
0040 
0041     void setCurrentColor(const QColor &color);
0042     QColor currentColor() const;
0043 
0044     QColor selectedColor() const;
0045 
0046     void setOption(ColorDialogOption option, bool on = true);
0047     bool testOption(ColorDialogOption option) const;
0048     void setOptions(ColorDialogOptions options);
0049     ColorDialogOptions options() const;
0050 
0051     using QDialog::open;
0052     void open(QObject *receiver, const char *member);
0053 
0054     void setVisible(bool visible) override;
0055 
0056     static QColor getColor(const QColor &initial = Qt::white,
0057                            QWidget *parent = nullptr,
0058                            const QString &title = QString(),
0059                            ColorDialogOptions options = ColorDialogOptions());
0060 
0061     static int customCount();
0062     static QColor customColor(int index);
0063     static void setCustomColor(int index, QColor color);
0064     static QColor standardColor(int index);
0065     static void setStandardColor(int index, QColor color);
0066 
0067 Q_SIGNALS:
0068     void currentColorChanged(const QColor &color);
0069     void colorSelected(const QColor &color);
0070 
0071 protected:
0072     void changeEvent(QEvent *event) override;
0073     void done(int result) override;
0074 
0075 private:
0076     Q_DISABLE_COPY(QColorDialog)
0077 };
0078 
0079 Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions)
0080 
0081 QT_END_NAMESPACE
0082 
0083 #endif // QCOLORDIALOG_H