KShare/colorpicker/colorpickerscene.hpp
ArsenArsen fcf5ac0269 Fix a few screen capture bugs for some multiconfig
Thanks to @lclc98 we worked around a bug in Qt<5.9 and made KShare work on weird multi monitor configurations where they for example overlap, also screens are now in proper positions despite what order they are in xrandr, for example.

Thanks again to @lclc98!
2017-07-03 15:43:28 +02:00

33 lines
923 B
C++

#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 {
public:
ColorPickerScene(QPixmap pixmap, QWidget *parentWidget);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override;
static void showPicker() {
new ColorPickerScene(screenshotutil::fullscreen(), 0);
}
private:
QImage image;
QColor color;
QGraphicsEllipseItem *ellipse = 0;
QGraphicsPixmapItem *pItem = 0;
QGraphicsTextItem *text;
QGraphicsRectItem *textBackground;
};
#endif // COLORPICKERSCENE_HPP