KShare/cropeditor/cropscene.hpp

34 lines
804 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;
2017-04-26 22:00:13 +02:00
QGraphicsPolygonItem *polyItem = nullptr;
2017-04-23 15:05:48 +02:00
};
#endif // CROPSCENE_HPP