KShare/cropeditor/cropscene.hpp

33 lines
758 B
C++
Raw Normal View History

2017-04-23 15:05:48 +02:00
#ifndef CROPSCENE_HPP
#define CROPSCENE_HPP
#include <QGraphicsRectItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QKeyEvent>
class CropScene : public QGraphicsScene
{
Q_OBJECT
public:
CropScene(QObject *parent);
virtual ~CropScene();
signals:
void closedWithRect(QRect rect);
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *e) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *e) override;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) override;
void keyReleaseEvent(QKeyEvent *e) override;
private:
void done();
QFlags<Qt::MouseButton> prevButtons;
QGraphicsRectItem *rect = nullptr;
QPointF initPos;
};
#endif // CROPSCENE_HPP