You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

33 lines
804 B

#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;
QGraphicsPolygonItem *polyItem = nullptr;
};
#endif // CROPSCENE_HPP