Commit 40d0e2d9 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.formEditorView: adding reset() by imports

changing imports now resets the form editor
parent a5ece6f6
......@@ -49,6 +49,7 @@
#include <QString>
#include <QDir>
#include <QAction>
#include <QTimer>
#include <zoomaction.h>
#include <nodeabstractproperty.h>
#include <nodelistproperty.h>
......@@ -143,6 +144,16 @@ void FormEditorView::modelAboutToBeDetached(Model *model)
QmlModelView::modelAboutToBeDetached(model);
}
void FormEditorView::importAdded(const Import &)
{
reset();
}
void FormEditorView::importRemoved(const Import &)
{
reset();
}
void FormEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
{
QmlItemNode qmlItemNode(removedNode);
......@@ -601,6 +612,23 @@ void FormEditorView::stateChanged(const QmlModelState &newQmlModelState, const Q
// m_currentTool->formEditorItemsChanged(itemList);
}
void FormEditorView::reset()
{
QTimer::singleShot(200, this, SLOT(delayedReset()));
}
void FormEditorView::delayedReset()
{
m_selectionTool->clear();
m_moveTool->clear();
m_resizeTool->clear();
m_anchorTool->clear();
m_dragTool->clear();
m_scene->clearFormEditorItems();
if (rootQmlObjectNode().toQmlItemNode().isValid())
setupFormEditorItemTree(rootQmlObjectNode().toQmlItemNode());
}
}
......@@ -66,6 +66,9 @@ public:
void modelAttached(Model *model);
void modelAboutToBeDetached(Model *model);
void importAdded(const Import &import);
void importRemoved(const Import &import);
void nodeCreated(const ModelNode &createdNode);
void nodeAboutToBeRemoved(const ModelNode &removedNode);
void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
......@@ -116,8 +119,10 @@ signals:
protected:
void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
void reset();
protected slots:
void delayedReset();
QList<ModelNode> adjustStatesForModelNodes(const QList<ModelNode> &nodeList) const;
void updateGraphicsIndicators();
void setSelectOnlyContentItemsAction(bool selectOnlyContentItems);
......
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