1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* UBColorPicker.h
*
* Created on: Nov 19, 2008
* Author: luc
*/
#ifndef UBCOLORPICKER_H_
#define UBCOLORPICKER_H_
#include <QtGui>
class UBColorPicker : public QFrame
{
Q_OBJECT;
public:
UBColorPicker(QWidget* parent);
UBColorPicker(QWidget* parent, const QList<QColor>& colors, int pSelectedColorIndex = 0);
virtual ~UBColorPicker();
QList<QColor> getColors() const
{
return mColors;
}
void setColors(const QList<QColor>& pColors)
{
mColors = pColors;
repaint();
}
int selectedColorIndex() const
{
return mSelectedColorIndex;
}
void setSelectedColorIndex(int pSelectedColorIndex)
{
mSelectedColorIndex = pSelectedColorIndex;
repaint();
}
signals:
void colorSelected(const QColor& color);
protected:
virtual void paintEvent ( QPaintEvent * event );
virtual void mousePressEvent ( QMouseEvent * event );
private:
QList<QColor> mColors;
int mSelectedColorIndex;
};
#endif /* UBCOLORPICKER_H_ */