tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
gradient_slider.hpp
Go to the documentation of this file.
1 
24 #ifndef GRADIENT_SLIDER_HPP
25 #define GRADIENT_SLIDER_HPP
26 
27 #include "colorpicker_global.hpp"
28 
29 #include <QSlider>
30 #include <QGradient>
31 
35 class QCP_EXPORT Gradient_Slider : public QSlider
36 {
37  Q_OBJECT
38  Q_PROPERTY(QBrush background READ background WRITE setBackground)
39  Q_PROPERTY(QGradientStops colors READ colors WRITE setColors DESIGNABLE false)
40  Q_PROPERTY(QColor firstColor READ firstColor WRITE setFirstColor STORED false)
41  Q_PROPERTY(QColor lastColor READ lastColor WRITE setLastColor STORED false)
42  Q_PROPERTY(QLinearGradient gradient READ gradient WRITE setGradient)
43 
44 public:
45  explicit Gradient_Slider(QWidget *parent = 0);
46  explicit Gradient_Slider(Qt::Orientation orientation, QWidget *parent = 0);
47  ~Gradient_Slider();
48 
50  QBrush background() const;
52  void setBackground(const QBrush &bg);
53 
55  QGradientStops colors() const;
57  void setColors(const QGradientStops &colors);
58 
60  QLinearGradient gradient() const;
62  void setGradient(const QLinearGradient &gradient);
63 
67  void setColors(const QVector<QColor> &colors);
68 
74  void setFirstColor(const QColor &c);
75 
82  void setLastColor(const QColor &c);
83 
89  QColor firstColor() const;
90 
96  QColor lastColor() const;
97 
98 protected:
99  void paintEvent(QPaintEvent *ev);
100 
101 private:
102  class Private;
103  Private * const p;
104 };
105 
106 #endif // GRADIENT_SLIDER_HPP
A slider that mover on top of a gradient.
Definition: gradient_slider.hpp:35
Definition: gradient_slider.cpp:32
#define QCP_EXPORT
Definition: colorpicker_global.hpp:9