KShare/cropeditor/drawing/lineitem.cpp

24 lines
431 B
C++
Raw Normal View History

2017-04-29 23:00:32 +02:00
#include "lineitem.hpp"
LineItem::LineItem()
{
}
LineItem::~LineItem()
{
delete path;
}
void LineItem::mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *)
{
if (path == nullptr)
path = new QPainterPath(e->scenePos());
else
path->lineTo(e->scenePos());
}
void LineItem::mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *scene)
{
scene->addPath(*path, scene->pen(), scene->brush());
}