| 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 | // | 
| 5 | //  W A R N I N G | 
| 6 | //  ------------- | 
| 7 | // | 
| 8 | // This file is not part of the Qt API. It exists for the convenience | 
| 9 | // of Qt Designer. This header file may change from version to version | 
| 10 | // without notice, or even be removed. | 
| 11 | // | 
| 12 | // We mean it. | 
| 13 | // | 
| 14 |  | 
| 15 | #ifndef QTCOLORBUTTON_H | 
| 16 | #define QTCOLORBUTTON_H | 
| 17 |  | 
| 18 | #include <QtWidgets/QToolButton> | 
| 19 |  | 
| 20 | QT_BEGIN_NAMESPACE | 
| 21 |  | 
| 22 | class QtColorButton : public QToolButton | 
| 23 | { | 
| 24 |     Q_OBJECT | 
| 25 |     Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered) | 
| 26 | public: | 
| 27 |     QtColorButton(QWidget *parent = 0); | 
| 28 |     ~QtColorButton(); | 
| 29 |  | 
| 30 |     bool isBackgroundCheckered() const; | 
| 31 |     void setBackgroundCheckered(bool checkered); | 
| 32 |  | 
| 33 |     QColor color() const; | 
| 34 |  | 
| 35 | public slots: | 
| 36 |     void setColor(QColor color); | 
| 37 |  | 
| 38 | signals: | 
| 39 |     void colorChanged(QColor color); | 
| 40 |  | 
| 41 | protected: | 
| 42 |     void paintEvent(QPaintEvent *event) override; | 
| 43 |     void mousePressEvent(QMouseEvent *event) override; | 
| 44 |     void mouseMoveEvent(QMouseEvent *event) override; | 
| 45 | #ifndef QT_NO_DRAGANDDROP | 
| 46 |     void dragEnterEvent(QDragEnterEvent *event) override; | 
| 47 |     void dragLeaveEvent(QDragLeaveEvent *event) override; | 
| 48 |     void dropEvent(QDropEvent *event) override; | 
| 49 | #endif | 
| 50 |  | 
| 51 | private: | 
| 52 |     QScopedPointer<class QtColorButtonPrivate> d_ptr; | 
| 53 |     Q_DECLARE_PRIVATE(QtColorButton) | 
| 54 |     Q_DISABLE_COPY_MOVE(QtColorButton) | 
| 55 | }; | 
| 56 |  | 
| 57 | QT_END_NAMESPACE | 
| 58 |  | 
| 59 | #endif | 
| 60 |  |