mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-21 18:19:59 +02:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user