--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/colorbutton.h Wed Jun 22 22:59:56 2022 +0300 @@ -0,0 +1,19 @@ +#pragma once +#include <QPushButton> + +/** + * @brief A button that can be used to select a color + */ +class ColorButton : public QPushButton +{ + Q_OBJECT + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) +public: + ColorButton(const QColor& color = {}, QWidget* parent = nullptr); + ColorButton(QWidget* parent = nullptr); + const QColor& color() const; + Q_SLOT void setColor(const QColor& color); + Q_SIGNAL void colorChanged(const QColor& color); +private: + QColor storedSelectedColor; +};