2017-05-16 15:52:15 +02:00
|
|
|
#ifndef COLORPICKERSCENE_HPP
|
|
|
|
#define COLORPICKERSCENE_HPP
|
|
|
|
|
|
|
|
#include <QGraphicsPixmapItem>
|
|
|
|
#include <QGraphicsScene>
|
|
|
|
#include <QGraphicsSceneMouseEvent>
|
|
|
|
#include <QGraphicsTextItem>
|
|
|
|
#include <QGraphicsView>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <screenshotutil.hpp>
|
|
|
|
|
|
|
|
class ColorPickerScene : public QGraphicsScene, public QGraphicsView {
|
2017-07-29 17:22:17 +02:00
|
|
|
Q_OBJECT
|
2017-06-14 23:34:58 +02:00
|
|
|
public:
|
2017-07-02 20:51:15 +02:00
|
|
|
ColorPickerScene(QPixmap pixmap, QWidget *parentWidget);
|
2017-05-16 15:52:15 +02:00
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override;
|
|
|
|
static void showPicker() {
|
2017-07-03 15:43:28 +02:00
|
|
|
new ColorPickerScene(screenshotutil::fullscreen(), 0);
|
2017-05-16 15:52:15 +02:00
|
|
|
}
|
|
|
|
|
2017-06-14 23:34:58 +02:00
|
|
|
private:
|
2017-07-03 15:43:28 +02:00
|
|
|
QImage image;
|
2017-05-16 15:52:15 +02:00
|
|
|
QColor color;
|
|
|
|
QGraphicsEllipseItem *ellipse = 0;
|
|
|
|
QGraphicsPixmapItem *pItem = 0;
|
|
|
|
QGraphicsTextItem *text;
|
|
|
|
QGraphicsRectItem *textBackground;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // COLORPICKERSCENE_HPP
|