TechDraw: Snap: disable snap if ALT is pressed.

This commit is contained in:
PaddleStroke
2024-06-24 14:23:20 +02:00
committed by Chris Hennes
parent 87154d75a8
commit e49f74aed9
2 changed files with 9 additions and 3 deletions

View File

@@ -22,6 +22,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QApplication>
# include <QGraphicsSceneHoverEvent>
# include <QGraphicsSceneMouseEvent>
# include <QPainter>
@@ -178,7 +179,9 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
}
else {
// For general views we check if we need to snap to a position
snapPosition(newPos);
if (!(QApplication::keyboardModifiers() & Qt::AltModifier)) {
snapPosition(newPos);
}
}
// tell the feature that we have moved

View File

@@ -29,6 +29,7 @@
#ifndef _PreComp_
# include <cmath>
# include <QApplication>
# include <QGraphicsScene>
# include <QGraphicsSceneMouseEvent>
# include <QPaintDevice>
@@ -132,8 +133,10 @@ QVariant QGIDatumLabel::itemChange(GraphicsItemChange change, const QVariant& va
}
}
else if (change == ItemPositionHasChanged && scene()) {
QPointF newPos = value.toPointF(); //position within parent!
snapPosition(newPos);
if (!(QApplication::keyboardModifiers() & Qt::AltModifier)) {
QPointF newPos = value.toPointF(); //position within parent!
snapPosition(newPos);
}
setLabelCenter();
m_dragState = Dragging;