BALL  1.5.0
colorButton.h
Go to the documentation of this file.
1 #ifndef BALL_VIEW_WIDGETS_COLORBUTTON_H
2 #define BALL_VIEW_WIDGETS_COLORBUTTON_H
3 
4 #ifndef BALL_COMMON_GLOBAL_
5 # include <BALL/COMMON/global.h>
6 #endif
7 
8 #include <QtWidgets/QPushButton>
9 #include <QtGui/QColor>
10 
11 class QPaintEvent;
12 
13 namespace BALL
14 {
15  namespace VIEW
16  {
17  class ColorRGBA;
18 
20  {
21  Q_OBJECT
22  Q_PROPERTY (QColor color_ READ getColor WRITE setColor USER true)
23  Q_PROPERTY (QColor default_color_ READ getDefaultColor WRITE setDefaultColor)
24 
25  public:
26  explicit ColorButton(QWidget* parent);
27  explicit ColorButton(const QColor& color, QWidget* parent);
28  explicit ColorButton(const QColor& color, const QColor& default_color, QWidget* parent);
29  explicit ColorButton(const ColorRGBA& color, QWidget* parent);
30  explicit ColorButton(const ColorRGBA& color, const ColorRGBA& defaultColor, QWidget* parent);
31 
32  virtual ~ColorButton();
33 
34  void setColor(const QColor& color);
35  void setColor(const ColorRGBA& color);
36  const QColor& getColor() const;
37 
38  void setDefaultColor(const QColor& color);
39  void setDefaultColor(const ColorRGBA& color);
40  const QColor& getDefaultColor() const;
41 
42  void setEnableAlpha(bool enable);
43  bool isAlphaEnabled() const;
44 
45  QSize sizeHint() const;
46 
47  public Q_SLOTS:
48  void chooseColor();
49 
50  Q_SIGNALS:
51  void colorChanged(QColor color);
52 
53  protected:
54  QColor color_;
55  QColor default_color_;
56 
57  bool enable_alpha_;
58 
59  virtual void paintEvent(QPaintEvent* evt);
60 
61  private:
62  void setup_();
63  };
64  }
65 }
66 
67 #endif //BALL_VIEW_WIDGETS_COLORBUTTON_H
BALL::VIEW::setColor
BALL_VIEW_EXPORT void setColor(const QLabel *label, const ColorRGBA &color)
BALL::VIEW::chooseColor
BALL_VIEW_EXPORT QColor chooseColor(QLabel *label)
BALL
Definition: constants.h:12
BALL::VIEW::ColorRGBA
Definition: colorRGBA.h:31
BALL::VIEW::ColorButton
Definition: colorButton.h:19
global.h
QWidget
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
BALL::VIEW::getColor
BALL_VIEW_EXPORT ColorRGBA getColor(const QLabel *label)
QPushButton