3 #include <QLineEdit> |
3 #include <QLineEdit> |
4 |
4 |
5 /** |
5 /** |
6 * @brief A button that can be used to select a color |
6 * @brief A button that can be used to select a color |
7 */ |
7 */ |
8 class ColorButton : public QWidget |
8 class ColorEdit : public QWidget |
9 { |
9 { |
10 Q_OBJECT |
10 Q_OBJECT |
11 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
11 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
12 QLineEdit* lineEdit; |
12 QLineEdit* lineEdit; |
13 QPushButton* button; |
13 QPushButton* button; |
14 public: |
14 public: |
15 ColorButton(const QColor& color = {}, QWidget* parent = nullptr); |
15 ColorEdit(const QColor& color = {}, QWidget* parent = nullptr); |
16 ColorButton(QWidget* parent = nullptr); |
16 ColorEdit(QWidget* parent = nullptr); |
17 QColor color() const; |
17 QColor color() const; |
18 Q_SLOT void setColor(const QColor& color); |
18 Q_SLOT void setColor(const QColor& color); |
19 Q_SIGNAL void colorChanged(const QColor& color); |
19 Q_SIGNAL void colorChanged(const QColor& color); |
20 }; |
20 }; |