a2b973d34e
Segfaults are real on this one. Basically, when I call this virtual method on a field which containts a pointer to a derived class from a pure virtual one the program segfaults. Please help.
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#ifndef CROPSCENE_HPP
|
|
#define CROPSCENE_HPP
|
|
|
|
#include <QGraphicsRectItem>
|
|
#include <QGraphicsScene>
|
|
#include <QGraphicsSceneContextMenuEvent>
|
|
#include <QGraphicsSceneMouseEvent>
|
|
#include <QKeyEvent>
|
|
|
|
class CropScene;
|
|
|
|
#include <cropeditor/drawing/drawitem.hpp>
|
|
|
|
class CropScene : public QGraphicsScene
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CropScene(QObject *parent);
|
|
QPen pen();
|
|
QBrush brush();
|
|
void setDrawingSelection(DrawItem *drawAction);
|
|
|
|
signals:
|
|
void closedWithRect(QRect rect);
|
|
|
|
protected:
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *e) override;
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *e) override;
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) override;
|
|
void contextMenuEvent(QGraphicsSceneContextMenuEvent *e) override;
|
|
|
|
void keyReleaseEvent(QKeyEvent *e) override;
|
|
|
|
private:
|
|
void addDrawingAction(QMenu &menu, DrawItem *item);
|
|
void done();
|
|
QFlags<Qt::MouseButton> prevButtons;
|
|
QGraphicsRectItem *rect = nullptr;
|
|
QPointF initPos;
|
|
QPen _pen;
|
|
QBrush _brush;
|
|
QGraphicsPolygonItem *polyItem = nullptr;
|
|
DrawItem *drawingSelection = nullptr;
|
|
};
|
|
|
|
#endif // CROPSCENE_HPP
|