forked from qt-creator/qt-creator
Improve undo/redo for move by cursor key
This commit is contained in:
@@ -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)
|
||||
{
|
||||
foreach (FormEditorItem* item, m_itemList)
|
||||
|
||||
@@ -69,6 +69,9 @@ public:
|
||||
|
||||
void moveBy(double deltaX, double deltaY);
|
||||
|
||||
void beginRewriterTransaction();
|
||||
void endRewriterTransaction();
|
||||
|
||||
QPointF beginPoint() const;
|
||||
|
||||
void clear();
|
||||
|
||||
@@ -156,6 +156,7 @@ void MoveTool::keyPressEvent(QKeyEvent *event)
|
||||
m_moveManipulator.setItems(movableItems);
|
||||
// m_selectionIndicator.hide();
|
||||
m_resizeIndicator.hide();
|
||||
m_moveManipulator.beginRewriterTransaction();
|
||||
}
|
||||
|
||||
switch(event->key()) {
|
||||
@@ -180,6 +181,7 @@ void MoveTool::keyReleaseEvent(QKeyEvent *keyEvent)
|
||||
}
|
||||
|
||||
if (!keyEvent->isAutoRepeat()) {
|
||||
m_moveManipulator.beginRewriterTransaction();
|
||||
m_moveManipulator.clear();
|
||||
// m_selectionIndicator.show();
|
||||
m_resizeIndicator.show();
|
||||
|
||||
Reference in New Issue
Block a user