2017-06-26 18:27:38 +02:00
|
|
|
#include "ellipseitem.hpp"
|
|
|
|
|
2017-07-08 21:40:09 +02:00
|
|
|
void EllipseItem::mouseDragEvent(QGraphicsSceneMouseEvent *, CropScene *scene) {
|
2017-06-26 18:27:38 +02:00
|
|
|
if (!ellie) {
|
2017-07-08 21:40:09 +02:00
|
|
|
ellie = scene->addEllipse(scene->cursorPosition().x(), scene->cursorPosition().y(), 0, 0, scene->pen(), scene->brush());
|
|
|
|
initPos = scene->cursorPosition();
|
2017-06-26 18:27:38 +02:00
|
|
|
} else {
|
2017-07-08 21:40:09 +02:00
|
|
|
auto p = scene->cursorPosition();
|
2017-06-26 18:27:38 +02:00
|
|
|
ellie->setRect(QRectF(qMin(initPos.x(), p.x()), qMin(initPos.y(), p.y()), qAbs(initPos.x() - p.x()),
|
|
|
|
qAbs(initPos.y() - p.y())));
|
|
|
|
}
|
|
|
|
}
|