color_preview.hpp
Go to the documentation of this file.
00001 
00023 #ifndef COLOR_PREVIEW_HPP
00024 #define COLOR_PREVIEW_HPP
00025 
00026 #include <QWidget>
00027 
00028 namespace color_widgets {
00029 
00033 class  ColorPreview : public QWidget
00034 {
00035     Q_OBJECT
00036     Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true)
00037     Q_PROPERTY(QColor comparisonColor READ comparisonColor WRITE setComparisonColor DESIGNABLE true)
00038     Q_PROPERTY(DisplayMode display_mode READ displayMode WRITE setDisplayMode DESIGNABLE true)
00039     Q_PROPERTY(QBrush background READ background WRITE setBackground DESIGNABLE true)
00040     Q_ENUMS(DisplayMode)
00041 public:
00042     enum DisplayMode
00043     {
00044         NoAlpha,    
00045         AllAlpha,   
00046         SplitAlpha, 
00047         SplitColor  
00048     };
00049 
00050     explicit ColorPreview(QWidget *parent = 0);
00051     ~ColorPreview();
00052 
00054     QBrush background() const;
00055 
00057     void setBackground(const QBrush &bk);
00058 
00060     DisplayMode displayMode() const;
00061 
00063     void setDisplayMode(DisplayMode dm);
00064 
00066     QColor color() const;
00067 
00069     QColor comparisonColor() const;
00070 
00071     QSize sizeHint () const;
00072 
00073     void paint(QPainter &painter, QRect rect) const;
00074     
00075 public slots:
00077     void setColor(const QColor &c);
00078 
00080     void setComparisonColor(const QColor &c);
00081 
00082 signals:
00084     void clicked();
00085 
00087     void colorChanged(QColor);
00088 
00089 protected:
00090     void paintEvent(QPaintEvent *);
00091     void resizeEvent(QResizeEvent *);
00092     void mouseReleaseEvent(QMouseEvent *ev);
00093     void mouseMoveEvent(QMouseEvent *ev);
00094 
00095 private:
00096     class Private;
00097     Private * const p;
00098 };
00099 
00100 } // namespace color_widgets
00101 
00102 #endif // COLOR_PREVIEW_HPP


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:55