KShare/cropeditor/drawing/lineitem.cpp

29 lines
529 B
C++

#include "lineitem.hpp"
LineItem::LineItem()
{
}
LineItem::~LineItem()
{
delete path;
}
void LineItem::mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene)
{
if (path == nullptr)
{
path = new QPainterPath(e->scenePos());
pathItem = scene->addPath(*path, scene->pen(), scene->brush());
}
else
{
path->quadTo(path->currentPosition(), e->scenePos());
pathItem->setPath(*path);
}
}
void LineItem::mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *)
{
}