File indexing completed on 2024-04-28 05:41:41
0001 /* 0002 Copied from Qt 5.6.3 sources, module qttools, directory src/shared/qtgradienteditor 0003 with small modifications to match more modern C++ standards and for no alpha-channel 0004 0005 This file is part of the tools applications of the Qt Toolkit. 0006 0007 SPDX-FileCopyrightText: 2015 The Qt Company Ltd. <http://www.qt.io/licensing/> 0008 0009 SPDX-License-Identifier: LGPL-2.1-only WITH Qt-LGPL-exception-1.1 OR LGPL-3.0-only WITH Qt-LGPL-exception-1.1 OR LicenseRef-Qt-Commercial 0010 */ 0011 0012 #ifndef QTCOLORBUTTON_H 0013 #define QTCOLORBUTTON_H 0014 0015 #include <QToolButton> 0016 0017 QT_BEGIN_NAMESPACE 0018 0019 class QtColorButton : public QToolButton 0020 { 0021 Q_OBJECT 0022 Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered) 0023 public: 0024 explicit QtColorButton(QWidget *parent = nullptr); 0025 ~QtColorButton() override; 0026 0027 bool isBackgroundCheckered() const; 0028 void setBackgroundCheckered(bool checkered); 0029 0030 QColor color() const; 0031 0032 public Q_SLOTS: 0033 0034 void setColor(const QColor &color); 0035 0036 Q_SIGNALS: 0037 void colorChanged(const QColor &color); 0038 protected: 0039 void paintEvent(QPaintEvent *event) override; 0040 void mousePressEvent(QMouseEvent *event) override; 0041 void mouseMoveEvent(QMouseEvent *event) override; 0042 #ifndef QT_NO_DRAGANDDROP 0043 void dragEnterEvent(QDragEnterEvent *event) override; 0044 void dragLeaveEvent(QDragLeaveEvent *event) override; 0045 void dropEvent(QDropEvent *event) override; 0046 #endif 0047 private: 0048 QScopedPointer<class QtColorButtonPrivate> d_ptr; 0049 Q_DECLARE_PRIVATE(QtColorButton) 0050 Q_DISABLE_COPY(QtColorButton) 0051 Q_PRIVATE_SLOT(d_func(), void slotEditColor()) 0052 }; 0053 0054 QT_END_NAMESPACE 0055 0056 #endif