Basic Shapes: Move coords corrected for XML, DXF export

(Bounding Rectangle had to be updated with each move)



git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2912 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
abhishekm71
2014-03-07 12:34:47 +00:00
parent b969f86d55
commit 7242854045
3 changed files with 33 additions and 1 deletions

View File

@@ -124,6 +124,31 @@ void QetShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
}
}
void QetShapeItem::mousePressEvent(QGraphicsSceneMouseEvent *e)
{
_origMousePress = mapToScene(e -> pos());
first_move_ = true;
if (e -> modifiers() & Qt::ControlModifier) {
setSelected(!isSelected());
}
QGraphicsItem::mousePressEvent(e);
}
void QetShapeItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
{
if (diagram()) diagram() -> endMoveElements();
QPointF newCoord = mapToScene(e -> pos());
if (newCoord != _origMousePress) {
//translate bounding rectangle
QRectF rec = boundingRect();
rec.translate(newCoord - _origMousePress);
setBoundingRect(rec);
setPos(pos() - newCoord + _origMousePress);
}
if (!(e -> modifiers() & Qt::ControlModifier)) QGraphicsItem::mouseReleaseEvent(e);
}
bool QetShapeItem::fromXml(const QDomElement &e)
{