mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 22:00:35 +01:00
Element editor : add a control key for moving by keyboard selected
primitives in 0.1 increments instead of 1
This commit is contained in:
@@ -110,6 +110,7 @@ void ElementScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsScene::mouseMoveEvent(e);
|
QGraphicsScene::mouseMoveEvent(e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -211,6 +212,21 @@ void ElementScene::keyPressEvent(QKeyEvent *event)
|
|||||||
{
|
{
|
||||||
QPointF original_pos = qgo->pos();
|
QPointF original_pos = qgo->pos();
|
||||||
QPointF p = qgo->pos();
|
QPointF p = qgo->pos();
|
||||||
|
|
||||||
|
if (event->modifiers() & Qt::ControlModifier) {
|
||||||
|
|
||||||
|
int k = event->key();
|
||||||
|
if(k == Qt::Key_Right)
|
||||||
|
p.rx() += 0.1;
|
||||||
|
else if (k == Qt::Key_Left)
|
||||||
|
p.rx() -= 0.1;
|
||||||
|
else if (k == Qt::Key_Up)
|
||||||
|
p.ry() -= 0.1;
|
||||||
|
else if (k == Qt::Key_Down)
|
||||||
|
p.ry() += 0.1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
int k = event->key();
|
int k = event->key();
|
||||||
if(k == Qt::Key_Right)
|
if(k == Qt::Key_Right)
|
||||||
p.rx() += 1;
|
p.rx() += 1;
|
||||||
@@ -220,6 +236,7 @@ void ElementScene::keyPressEvent(QKeyEvent *event)
|
|||||||
p.ry() -= 1;
|
p.ry() -= 1;
|
||||||
else if (k == Qt::Key_Down)
|
else if (k == Qt::Key_Down)
|
||||||
p.ry() += 1;
|
p.ry() += 1;
|
||||||
|
}
|
||||||
|
|
||||||
qgo->setPos(p);
|
qgo->setPos(p);
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(qgo, "pos", QVariant(original_pos), QVariant(p));
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(qgo, "pos", QVariant(original_pos), QVariant(p));
|
||||||
|
|||||||
Reference in New Issue
Block a user