color_preview.hpp
Go to the documentation of this file.
1 
23 #ifndef COLOR_PREVIEW_HPP
24 #define COLOR_PREVIEW_HPP
25 
26 #include <QWidget>
27 
28 namespace color_widgets {
29 
33 class ColorPreview : public QWidget
34 {
35  Q_OBJECT
36  Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true)
37  Q_PROPERTY(QColor comparisonColor READ comparisonColor WRITE setComparisonColor DESIGNABLE true)
38  Q_PROPERTY(DisplayMode display_mode READ displayMode WRITE setDisplayMode DESIGNABLE true)
39  Q_PROPERTY(QBrush background READ background WRITE setBackground DESIGNABLE true)
40  Q_ENUMS(DisplayMode)
41 public:
43  {
48  };
49 
50  explicit ColorPreview(QWidget *parent = 0);
51  ~ColorPreview();
52 
54  QBrush background() const;
55 
57  void setBackground(const QBrush &bk);
58 
60  DisplayMode displayMode() const;
61 
63  void setDisplayMode(DisplayMode dm);
64 
66  QColor color() const;
67 
69  QColor comparisonColor() const;
70 
71  QSize sizeHint () const;
72 
73  void paint(QPainter &painter, QRect rect) const;
74 
75 public slots:
77  void setColor(const QColor &c);
78 
80  void setComparisonColor(const QColor &c);
81 
82 signals:
84  void clicked();
85 
87  void colorChanged(QColor);
88 
89 protected:
90  void paintEvent(QPaintEvent *);
91  void resizeEvent(QResizeEvent *);
92  void mouseReleaseEvent(QMouseEvent *ev);
93  void mouseMoveEvent(QMouseEvent *ev);
94 
95 private:
96  class Private;
97  Private * const p;
98 };
99 
100 } // namespace color_widgets
101 
102 #endif // COLOR_PREVIEW_HPP
QColor comparisonColor() const
Get the comparison color.
DisplayMode displayMode() const
Get color display mode.
void setColor(const QColor &c)
Set current color.
void colorChanged(QColor)
Emitted on setColor.
void setBackground(const QBrush &bk)
Change the background visible under transparent colors.
void paint(QPainter &painter, QRect rect) const
Show both solid and transparent side by side.
void resizeEvent(QResizeEvent *)
void paintEvent(QPaintEvent *)
show current color with transparency
Show current and comparison colors side by side.
void clicked()
Emitted when the user clicks on the widget.
ColorPreview(QWidget *parent=0)
QColor color() const
Get current color.
void mouseReleaseEvent(QMouseEvent *ev)
Show current color with no transparency.
void setDisplayMode(DisplayMode dm)
Set how transparent colors are handled.
QBrush background() const
Get the background visible under transparent colors.
void setComparisonColor(const QColor &c)
Set the comparison color.
void mouseMoveEvent(QMouseEvent *ev)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17