OGS
ColorPickerPushButton.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 // ** INCLUDES **
18 #include <QPushButton>
19 
20 class QColor;
21 class QMouseEvent;
22 
28 class ColorPickerPushButton : public QPushButton
29 {
30  Q_OBJECT
31 
32 public:
33  explicit ColorPickerPushButton(QWidget* parent = nullptr);
34 
35 public slots:
37  void mouseReleaseEvent(QMouseEvent* e) override;
38 
40  void setColor(QColor color);
41  void setColor(double* color);
42 
43 private:
44  QString colorToCss(QColor color);
45  QString colorToString(QColor color);
46 
47  QColor _color;
48 
49 signals:
51  void colorPicked(QColor);
52 };
void mouseReleaseEvent(QMouseEvent *e) override
Calls the QColorDialog.
void colorPicked(QColor)
Is emitted when a color was picked from the dialog.
ColorPickerPushButton(QWidget *parent=nullptr)
void setColor(QColor color)
Sets the color.
QString colorToString(QColor color)
QString colorToCss(QColor color)