00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef GRADIENTS_H
00015 #define GRADIENTS_H
00016
00017 #include "hoverpoints.h"
00018
00019 #include <QtGui>
00020
00021 class HoverPoints;
00022
00023 class ShadeWidget : public QWidget
00024 {
00025 Q_OBJECT
00026 public:
00027 enum ShadeType {
00028 RedShade,
00029 GreenShade,
00030 BlueShade,
00031 RGBShade
00032 };
00033
00034 ShadeWidget(ShadeType type, QWidget *parent);
00035
00036 void setGradientStops(const QGradientStops &stops);
00037 void setPointsFromGradientStops(const QGradientStops &stops);
00038
00039 void paintEvent(QPaintEvent *e);
00040
00041 QSize sizeHint() const { return QSize(250, 60); }
00042 QPolygonF points() const;
00043
00044 HoverPoints *hoverPoints() const { return m_hoverPoints; }
00045
00046 uint colorAt(int x);
00047
00048 signals:
00049 void colorsChanged();
00050
00051 private:
00052 void generateShade();
00053
00054 ShadeType m_shade_type;
00055 QImage m_shade;
00056 HoverPoints *m_hoverPoints;
00057 QLinearGradient m_alpha_gradient;
00058 };
00059
00060 #endif