2016-12-06 01:48:26 +01:00
|
|
|
#ifndef COLORBOX_H
|
|
|
|
#define COLORBOX_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class ColorBox : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ColorBox(QWidget *parent = 0);
|
|
|
|
|
|
|
|
const QColor &color() const {return _color;}
|
|
|
|
void setColor(const QColor &color);
|
2017-09-15 08:30:00 +02:00
|
|
|
void enableAlphaChannel(bool enable) {_alpha = enable;}
|
2016-12-06 01:48:26 +01:00
|
|
|
|
|
|
|
QSize sizeHint() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void colorChanged(const QColor &color);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
void paintEvent(QPaintEvent *event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QColor _color;
|
2017-09-15 08:30:00 +02:00
|
|
|
bool _alpha;
|
2016-12-06 01:48:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // COLORBOX_H
|