Commit 4e0eddff authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.propertyEditor: Reset property editor when changing mode

When entering the design mode the property editor is reset.
This reduces complexity since the property editor is reset instead of
having to react to all the possible changes from text.

The same is done for the NodeInstanceView
parent 134e41ee
......@@ -43,6 +43,7 @@
#include <navigatorview.h>
#include <stateseditorview.h>
#include <formeditorview.h>
#include <propertyeditor.h>
#include <formeditorwidget.h>
#include <basetexteditmodifier.h>
#include <componenttextmodifier.h>
......@@ -199,7 +200,6 @@ void DesignDocumentController::blockModelSync(bool block)
detachNodeInstanceView();
m_d->textModifier->deactivateChangeSignals();
} else {
attachNodeInstanceView();
QmlModelState state;
//We go back to base state (and back again) to avoid side effects from text editing.
if (m_d->statesEditorView && m_d->statesEditorView->model()) {
......@@ -212,6 +212,9 @@ void DesignDocumentController::blockModelSync(bool block)
if (state.isValid() && m_d->statesEditorView)
m_d->statesEditorView->setCurrentState(state);
attachNodeInstanceView();
if (m_d->allPropertiesBox->view())
m_d->allPropertiesBox->view()->resetView();
}
}
}
......
......@@ -75,6 +75,11 @@ void AllPropertiesBox::setModel(Model* model)
m_d->propertiesEditor->model()->detachView(m_d->propertiesEditor);
}
PropertyEditor* AllPropertiesBox::view() const
{
return m_d->propertiesEditor;
}
void AllPropertiesBox::showNewLook()
{
setCurrentIndex(m_newLookIndex);
......
......@@ -40,6 +40,7 @@ namespace QmlDesigner {
class FormWindow;
class Model;
class ModelState;
class PropertyEditor;
class AllPropertiesBox: public QStackedWidget
{
......@@ -54,6 +55,9 @@ public:
void setModel(Model *model);
PropertyEditor* view() const;
private:
private:
......
......@@ -806,6 +806,9 @@ void PropertyEditor::propertiesRemoved(const QList<AbstractProperty>& propertyLi
if (!m_selectedNode.isValid())
return;
if (!QmlObjectNode(m_selectedNode).isValid())
return;
foreach (const AbstractProperty &property, propertyList) {
ModelNode node(property.parentModelNode());
if (node == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == node) {
......@@ -825,6 +828,9 @@ void PropertyEditor::variantPropertiesChanged(const QList<VariantProperty>& prop
if (!m_selectedNode.isValid())
return;
if (!QmlObjectNode(m_selectedNode).isValid())
return;
foreach (const VariantProperty &property, propertyList) {
ModelNode node(property.parentModelNode());
......@@ -844,6 +850,9 @@ void PropertyEditor::bindingPropertiesChanged(const QList<BindingProperty>& prop
if (!m_selectedNode.isValid())
return;
if (!QmlObjectNode(m_selectedNode).isValid())
return;
foreach (const BindingProperty &property, propertyList) {
ModelNode node(property.parentModelNode());
......@@ -877,6 +886,9 @@ void PropertyEditor::nodeIdChanged(const ModelNode& node, const QString& newId,
if (!m_selectedNode.isValid())
return;
if (!QmlObjectNode(m_selectedNode).isValid())
return;
if (node == m_selectedNode) {
if (m_currentType) {
......
......@@ -110,6 +110,8 @@ public:
void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId);
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void resetView();
protected:
void timerEvent(QTimerEvent *event);
void otherPropertyChanged(const QmlObjectNode &, const QString &propertyName);
......@@ -133,7 +135,6 @@ private: //functions
QString locateQmlFile(const QString &relativePath) const;
void select(const ModelNode& node);
void resetView();
void delayedResetView();
......
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