| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef COLORTOOLBUTTON_H |
| 4 | #define COLORTOOLBUTTON_H |
| 5 | |
| 6 | #include <QToolButton> |
| 7 | |
| 8 | class RSSGUARD_DLLSPEC ColorToolButton : public QToolButton { |
| 9 | Q_OBJECT |
| 10 | |
| 11 | public: |
| 12 | explicit ColorToolButton(QWidget* parent = nullptr); |
| 13 | |
| 14 | QColor color() const; |
| 15 | void setColor(const QColor& color, bool inform_about_changes = true); |
| 16 | |
| 17 | QColor alternateColor() const; |
| 18 | void setAlternateColor(const QColor& alt_color); |
| 19 | |
| 20 | public slots: |
| 21 | void setRandomColor(); |
| 22 | |
| 23 | signals: |
| 24 | void colorChanged(const QColor& new_color); |
| 25 | |
| 26 | protected: |
| 27 | virtual void mouseReleaseEvent(QMouseEvent* event); |
| 28 | virtual void paintEvent(QPaintEvent* e); |
| 29 | |
| 30 | private: |
| 31 | QColor m_color; |
| 32 | QColor m_alternateColor; |
| 33 | }; |
| 34 | |
| 35 | #endif // COLORTOOLBUTTON_H |