summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-12-17 11:23:42 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-18 12:40:34 +0100
commit2bb268a8866e8649006aa1d145797cca8e02e009 (patch)
treee8eb137ec8d7da9097fb4133ae04b991cc112a8b
parent2be2eb83ff0a1a66a6d3500cf1f802d291c97d42 (diff)
downloadqttools-2bb268a8866e8649006aa1d145797cca8e02e009.tar.gz
Qt Designer: Clear undo stack when reloading form.
Task-number: QTCREATORBUG-11119 Change-Id: I4ad9a4ac16f17fec292264896b82f881a4ca5a7d Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
-rw-r--r--src/designer/src/components/formeditor/formwindow.cpp1
-rw-r--r--src/designer/src/components/formeditor/qdesignerundostack.cpp6
-rw-r--r--src/designer/src/components/formeditor/qdesignerundostack.h1
3 files changed, 8 insertions, 0 deletions
diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp
index 9ac7fb55b..d26b5d5ba 100644
--- a/src/designer/src/components/formeditor/formwindow.cpp
+++ b/src/designer/src/components/formeditor/formwindow.cpp
@@ -2159,6 +2159,7 @@ bool FormWindow::setContents(QIODevice *dev, QString *errorMessageIn /* = 0 */)
// The main container is cleared as otherwise
// the names of the newly loaded objects will be unified.
clearMainContainer();
+ m_undoStack.clear();
emit changed();
QDesignerResource r(this);
diff --git a/src/designer/src/components/formeditor/qdesignerundostack.cpp b/src/designer/src/components/formeditor/qdesignerundostack.cpp
index 48c36fc5f..cc533f9b6 100644
--- a/src/designer/src/components/formeditor/qdesignerundostack.cpp
+++ b/src/designer/src/components/formeditor/qdesignerundostack.cpp
@@ -60,6 +60,12 @@ QDesignerUndoStack::~QDesignerUndoStack()
{ // QUndoStack is managed by the QUndoGroup
}
+void QDesignerUndoStack::clear()
+{
+ m_fakeDirty = false;
+ m_undoStack->clear();
+}
+
void QDesignerUndoStack::push(QUndoCommand * cmd)
{
m_undoStack->push(cmd);
diff --git a/src/designer/src/components/formeditor/qdesignerundostack.h b/src/designer/src/components/formeditor/qdesignerundostack.h
index 01f3d29e3..84d56184e 100644
--- a/src/designer/src/components/formeditor/qdesignerundostack.h
+++ b/src/designer/src/components/formeditor/qdesignerundostack.h
@@ -62,6 +62,7 @@ public:
explicit QDesignerUndoStack(QObject *parent = 0);
virtual ~QDesignerUndoStack();
+ void clear();
void push(QUndoCommand * cmd);
void beginMacro(const QString &text);
void endMacro();