Commit f133d0ac authored by Marco Bubke's avatar Marco Bubke
Browse files

Improve undo/redo for move by cursor key

parent 3aa10a74
...@@ -345,6 +345,16 @@ void MoveManipulator::moveBy(double deltaX, double deltaY) ...@@ -345,6 +345,16 @@ void MoveManipulator::moveBy(double deltaX, double deltaY)
} }
} }
void MoveManipulator::beginRewriterTransaction()
{
m_rewriterTransaction = m_view->beginRewriterTransaction();
}
void MoveManipulator::endRewriterTransaction()
{
m_rewriterTransaction.commit();
}
void MoveManipulator::setOpacityForAllElements(qreal opacity) void MoveManipulator::setOpacityForAllElements(qreal opacity)
{ {
foreach (FormEditorItem* item, m_itemList) foreach (FormEditorItem* item, m_itemList)
......
...@@ -69,6 +69,9 @@ public: ...@@ -69,6 +69,9 @@ public:
void moveBy(double deltaX, double deltaY); void moveBy(double deltaX, double deltaY);
void beginRewriterTransaction();
void endRewriterTransaction();
QPointF beginPoint() const; QPointF beginPoint() const;
void clear(); void clear();
......
...@@ -156,6 +156,7 @@ void MoveTool::keyPressEvent(QKeyEvent *event) ...@@ -156,6 +156,7 @@ void MoveTool::keyPressEvent(QKeyEvent *event)
m_moveManipulator.setItems(movableItems); m_moveManipulator.setItems(movableItems);
// m_selectionIndicator.hide(); // m_selectionIndicator.hide();
m_resizeIndicator.hide(); m_resizeIndicator.hide();
m_moveManipulator.beginRewriterTransaction();
} }
switch(event->key()) { switch(event->key()) {
...@@ -180,6 +181,7 @@ void MoveTool::keyReleaseEvent(QKeyEvent *keyEvent) ...@@ -180,6 +181,7 @@ void MoveTool::keyReleaseEvent(QKeyEvent *keyEvent)
} }
if (!keyEvent->isAutoRepeat()) { if (!keyEvent->isAutoRepeat()) {
m_moveManipulator.beginRewriterTransaction();
m_moveManipulator.clear(); m_moveManipulator.clear();
// m_selectionIndicator.show(); // m_selectionIndicator.show();
m_resizeIndicator.show(); m_resizeIndicator.show();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment