Toolbox Qt
Loading...
Searching...
No Matches
colorbutton.h
1#ifndef TBQ_WIDGETS_COLORBUTTON_H
2#define TBQ_WIDGETS_COLORBUTTON_H
3
4#include "toolboxqt/toolboxqt_global.h"
5
6#include <QPushButton>
7
8namespace tbq
9{
10
11class TOOLBOXQT_EXPORT ColorButton : public QPushButton
12{
13 Q_OBJECT
14
15public:
16 enum class ColorShape
17 {
18 COLOR_SHAPE_CIRCLE = 0,
19 COLOR_SHAPE_RECT
20 };
21 Q_ENUM(ColorShape);
22
23public:
24 explicit ColorButton(QWidget *parent = nullptr);
25
26public:
27 ColorShape getShape() const;
28 const QColor& getColor() const;
29
30public:
31 void setShape(ColorShape shape);
32 void setColor(const QColor &color);
33
34signals:
35 void sColorChanged(const QColor &color);
36
37protected:
38 void paintEvent(QPaintEvent *event) override;
39
40private:
41 void chooseColor();
42
43private:
44 ColorShape m_shape;
45 QColor m_color;
46};
47
48} // namespace tbq
49
50#endif // TBQ_WIDGETS_COLORBUTTON_H
Button used to pick a color.
Definition colorbutton.h:12
void sColorChanged(const QColor &color)
Signal emitted when new color has been selected.
Namespace used for ToolBoxQt library.
Definition array2d.h:12