KShare/cropeditor/cropscene.hpp

47 lines
1.1 KiB
C++
Raw Normal View History

2017-04-23 15:05:48 +02:00
#ifndef CROPSCENE_HPP
#define CROPSCENE_HPP
#include <QGraphicsRectItem>
#include <QGraphicsScene>
2017-04-29 12:08:02 +02:00
#include <QGraphicsSceneContextMenuEvent>
2017-04-23 15:05:48 +02:00
#include <QGraphicsSceneMouseEvent>
#include <QKeyEvent>
class CropScene;
#include <cropeditor/drawing/drawitem.hpp>
2017-04-23 15:05:48 +02:00
class CropScene : public QGraphicsScene
{
Q_OBJECT
public:
CropScene(QObject *parent);
QPen pen();
QBrush brush();
void setDrawingSelection(DrawItem *drawAction);
2017-04-23 15:05:48 +02:00
signals:
void closedWithRect(QRect rect);
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *e) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *e) override;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) override;
2017-04-29 12:08:02 +02:00
void contextMenuEvent(QGraphicsSceneContextMenuEvent *e) override;
2017-04-23 15:05:48 +02:00
void keyReleaseEvent(QKeyEvent *e) override;
private:
void addDrawingAction(QMenu &menu, DrawItem *item);
2017-04-23 15:05:48 +02:00
void done();
QFlags<Qt::MouseButton> prevButtons;
QGraphicsRectItem *rect = nullptr;
QPointF initPos;
QPen _pen;
QBrush _brush;
2017-04-26 22:00:13 +02:00
QGraphicsPolygonItem *polyItem = nullptr;
DrawItem *drawingSelection = nullptr;
2017-04-23 15:05:48 +02:00
};
#endif // CROPSCENE_HPP