tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
color_preview.hpp
Go to the documentation of this file.
1 
24 #ifndef COLOR_PREVIEW_HPP
25 #define COLOR_PREVIEW_HPP
26 
27 #include "colorpicker_global.hpp"
28 
29 #include <QWidget>
30 
35 // fixed for Qt 5.8
36 
37 class QCP_EXPORT Color_Preview : public QWidget {
38  Q_OBJECT
39  Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true)
40  Q_PROPERTY(QColor comparisonColor READ comparisonColor WRITE setComparisonColor DESIGNABLE true)
41  Q_PROPERTY(Display_Mode display_mode READ displayMode WRITE setDisplayMode DESIGNABLE true)
42  Q_PROPERTY(QBrush background READ background WRITE setBackground DESIGNABLE true)
43 
44 public:
45  typedef enum {
49  SplitColor
50  } Display_Mode;
51 
53 
54  explicit Color_Preview(QWidget* parent = 0);
55  ~Color_Preview();
56 
58  QBrush background() const;
59 
61  void setBackground(const QBrush& bk);
62 
64  Display_Mode displayMode() const;
65 
67  void setDisplayMode(Display_Mode dm);
68 
70  QColor color() const;
71 
73  QColor comparisonColor() const;
74 
75  QSize sizeHint() const;
76 
77  void paint(QPainter& painter, QRect rect) const;
78 
79 public slots:
81  void setColor(const QColor& c);
82 
84  void setComparisonColor(const QColor& c);
85 
86 signals:
88  void clicked();
89 
91  void colorChanged(QColor);
92 
93 protected:
94  void paintEvent(QPaintEvent*);
95  void resizeEvent(QResizeEvent*);
96  void mouseReleaseEvent(QMouseEvent* ev);
97  void mouseMoveEvent(QMouseEvent* ev);
98 
99 private:
100  class Private;
101  Private* const p;
102 };
103 
104 #endif // COLOR_PREVIEW_HPP
Show both solid and transparent side by side.
Definition: color_preview.hpp:48
Show current color with no transparency.
Definition: color_preview.hpp:46
#define QCP_EXPORT
Definition: colorpicker_global.hpp:9
Definition: color_preview.hpp:37
show current color with transparency
Definition: color_preview.hpp:47
Display_Mode
Definition: color_preview.hpp:45