2017-04-29 23:00:32 +02:00
|
|
|
#include "lineitem.hpp"
|
|
|
|
|
|
|
|
LineItem::LineItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
LineItem::~LineItem()
|
|
|
|
{
|
|
|
|
delete path;
|
|
|
|
}
|
|
|
|
|
2017-04-29 23:20:08 +02:00
|
|
|
void LineItem::mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene)
|
2017-04-29 23:00:32 +02:00
|
|
|
{
|
|
|
|
if (path == nullptr)
|
2017-04-29 23:20:08 +02:00
|
|
|
{
|
2017-04-29 23:00:32 +02:00
|
|
|
path = new QPainterPath(e->scenePos());
|
2017-04-29 23:20:08 +02:00
|
|
|
pathItem = scene->addPath(*path, scene->pen(), scene->brush());
|
|
|
|
}
|
2017-04-29 23:00:32 +02:00
|
|
|
else
|
2017-04-29 23:20:08 +02:00
|
|
|
{
|
2017-05-01 11:28:54 +02:00
|
|
|
path->quadTo(path->currentPosition(), e->scenePos());
|
2017-04-29 23:20:08 +02:00
|
|
|
pathItem->setPath(*path);
|
|
|
|
}
|
2017-04-29 23:00:32 +02:00
|
|
|
}
|
|
|
|
|
2017-04-29 23:20:08 +02:00
|
|
|
void LineItem::mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *)
|
2017-04-29 23:00:32 +02:00
|
|
|
{
|
|
|
|
}
|