ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gradientdialogwidget.h
Go to the documentation of this file.
1 #ifndef GRADIENTDIALOGWIDGET_H
2 #define GRADIENTDIALOGWIDGET_H
3 
4 #include <QWidget>
5 #include <QMouseEvent>
6 #include <QPaintEvent>
7 
9 {
10  Q_OBJECT
11 public:
12  explicit GradientDialogWidget(QWidget *parent = 0);
13 
14  void setStops(const QGradientStops& stops);
15  inline QGradientStops stops() { return _stops; }
16  inline int stopCount() { return _stops.count(); }
17 
18  QColor colorAt(int position);
19 
20  inline int current() { return _current; }
21  int moveCurrent(int to);
22  void setCurrentColor(const QColor& color);
23 
24 signals:
25  void currentChanged(QColor color, bool spontaneous, int position);
26 
27 private:
28  QColor selected;
30  int _current;
31  QMap<int, QColor> _colors;
32  QGradientStops _stops;
33 
34  QRect fillRect();
35  QRect stopRect(int pos);
36  int selectedStop();
37  QMap<int, QColor> selectionColors();
38  void makeStops();
39 
40  void paintEvent(QPaintEvent*);
41  void mousePressEvent(QMouseEvent* event);
42  void mouseMoveEvent(QMouseEvent* event);
43  void mouseReleaseEvent(QMouseEvent* event);
44 };
45 
46 #endif // GRADIENTDIALOGWIDGET_H
QColor colorAt(int position)
void mouseMoveEvent(QMouseEvent *event)
void mousePressEvent(QMouseEvent *event)
void currentChanged(QColor color, bool spontaneous, int position)
void setStops(const QGradientStops &stops)
QMap< int, QColor > selectionColors()
void setCurrentColor(const QColor &color)
void mouseReleaseEvent(QMouseEvent *event)
GradientDialogWidget(QWidget *parent=0)
QMap< int, QColor > _colors
void paintEvent(QPaintEvent *)