forked from qt-creator/qt-creator
QmlDesigner: use one node instance view
Bauhaus now uses only one single instance view. Done by Marco Bubke
This commit is contained in:
@@ -51,6 +51,9 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <zoomaction.h>
|
#include <zoomaction.h>
|
||||||
|
#include <nodeabstractproperty.h>
|
||||||
|
#include <nodelistproperty.h>
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -264,6 +267,9 @@ void FormEditorView::scriptFunctionsChanged(const ModelNode &node, const QString
|
|||||||
QmlModelView::scriptFunctionsChanged(node, scriptFunctionList);
|
QmlModelView::scriptFunctionsChanged(node, scriptFunctionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormEditorView::propertiesRemoved(const QList<AbstractProperty> &/*propertyList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
AbstractFormEditorTool* FormEditorView::currentTool() const
|
AbstractFormEditorTool* FormEditorView::currentTool() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ public:
|
|||||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||||
const QList<ModelNode> &lastSelectedNodeList);
|
const QList<ModelNode> &lastSelectedNodeList);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
void propertiesRemoved(const QList<AbstractProperty> &propertyList);
|
||||||
|
|
||||||
// FormEditorView
|
// FormEditorView
|
||||||
FormEditorWidget *widget() const;
|
FormEditorWidget *widget() const;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include <variantproperty.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <model.h>
|
#include <model.h>
|
||||||
#include <qmlanchors.h>
|
#include <qmlanchors.h>
|
||||||
|
#include <variantproperty.h>
|
||||||
|
#include <nodeabstractproperty.h>
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ void ComponentView::variantPropertiesChanged(const QList<VariantProperty>& /*pro
|
|||||||
void ComponentView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
|
void ComponentView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
|
||||||
void ComponentView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
|
void ComponentView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
|
||||||
void ComponentView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
|
void ComponentView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
|
||||||
|
void ComponentView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList) {};
|
||||||
|
|
||||||
|
|
||||||
void ComponentView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/,
|
void ComponentView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/,
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
|
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||||
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||||
const QList<ModelNode> &lastSelectedNodeList);
|
const QList<ModelNode> &lastSelectedNodeList);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include <rewritingexception.h>
|
#include <rewritingexception.h>
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
#include <toolbox.h>
|
#include <toolbox.h>
|
||||||
|
#include <variantproperty.h>
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
@@ -87,6 +88,7 @@ public:
|
|||||||
QWeakPointer<AllPropertiesBox> allPropertiesBox;
|
QWeakPointer<AllPropertiesBox> allPropertiesBox;
|
||||||
QWeakPointer<StatesEditorWidget> statesEditorWidget;
|
QWeakPointer<StatesEditorWidget> statesEditorWidget;
|
||||||
QWeakPointer<QStackedWidget> stackedWidget;
|
QWeakPointer<QStackedWidget> stackedWidget;
|
||||||
|
QWeakPointer<NodeInstanceView> nodeInstanceView;
|
||||||
|
|
||||||
QWeakPointer<QmlDesigner::Model> model;
|
QWeakPointer<QmlDesigner::Model> model;
|
||||||
QWeakPointer<QmlDesigner::Model> subComponentModel;
|
QWeakPointer<QmlDesigner::Model> subComponentModel;
|
||||||
@@ -212,6 +214,11 @@ void DesignDocumentController::setFormEditorView(FormEditorView *formEditorView)
|
|||||||
m_d->formEditorView = formEditorView;
|
m_d->formEditorView = formEditorView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesignDocumentController::setNodeInstanceView(NodeInstanceView *nodeInstanceView)
|
||||||
|
{
|
||||||
|
m_d->nodeInstanceView = nodeInstanceView;
|
||||||
|
}
|
||||||
|
|
||||||
QString DesignDocumentController::displayName() const
|
QString DesignDocumentController::displayName() const
|
||||||
{
|
{
|
||||||
if (fileName().isEmpty())
|
if (fileName().isEmpty())
|
||||||
@@ -344,6 +351,7 @@ void DesignDocumentController::loadCurrentModel()
|
|||||||
Q_ASSERT(m_d->model);
|
Q_ASSERT(m_d->model);
|
||||||
m_d->model->setMasterModel(m_d->masterModel.data());
|
m_d->model->setMasterModel(m_d->masterModel.data());
|
||||||
|
|
||||||
|
m_d->model->attachView(m_d->nodeInstanceView.data());
|
||||||
m_d->model->attachView(m_d->navigator.data());
|
m_d->model->attachView(m_d->navigator.data());
|
||||||
m_d->itemLibrary->setItemLibraryInfo(m_d->model->metaInfo().itemLibraryInfo());
|
m_d->itemLibrary->setItemLibraryInfo(m_d->model->metaInfo().itemLibraryInfo());
|
||||||
m_d->itemLibrary->setResourcePath(QFileInfo(m_d->fileName).absolutePath());
|
m_d->itemLibrary->setResourcePath(QFileInfo(m_d->fileName).absolutePath());
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public:
|
|||||||
void setAllPropertiesBox(AllPropertiesBox* allPropertiesBox);
|
void setAllPropertiesBox(AllPropertiesBox* allPropertiesBox);
|
||||||
void setStatesEditorWidget(StatesEditorWidget* statesEditorWidget);
|
void setStatesEditorWidget(StatesEditorWidget* statesEditorWidget);
|
||||||
void setFormEditorView(FormEditorView *formEditorView);
|
void setFormEditorView(FormEditorView *formEditorView);
|
||||||
|
void setNodeInstanceView(NodeInstanceView *nodeInstanceView);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void displayNameChanged(const QString &newFileName);
|
void displayNameChanged(const QString &newFileName);
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ void DesignDocumentControllerView::scriptFunctionsChanged(const ModelNode &/*nod
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesignDocumentControllerView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static QStringList arrayToStringList(const QByteArray &byteArray)
|
static QStringList arrayToStringList(const QByteArray &byteArray)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ public:
|
|||||||
|
|
||||||
virtual void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
virtual void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
||||||
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
|
|
||||||
ModelNode insertModel(const ModelNode &modelNode)
|
ModelNode insertModel(const ModelNode &modelNode)
|
||||||
{ return m_modelMerger.insertModel(modelNode); }
|
{ return m_modelMerger.insertModel(modelNode); }
|
||||||
|
|||||||
@@ -190,6 +190,9 @@ void NavigatorView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStr
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NavigatorView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void NavigatorView::nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &node, int oldIndex)
|
void NavigatorView::nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &node, int oldIndex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
const QList<ModelNode> &lastSelectedNodeList);
|
const QList<ModelNode> &lastSelectedNodeList);
|
||||||
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// void handleChangedItem(QStandardItem * item);
|
// void handleChangedItem(QStandardItem * item);
|
||||||
|
|||||||
@@ -40,6 +40,10 @@
|
|||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <propertymetainfo.h>
|
#include <propertymetainfo.h>
|
||||||
|
|
||||||
|
#include <bindingproperty.h>
|
||||||
|
|
||||||
|
#include <nodeabstractproperty.h>
|
||||||
|
|
||||||
#include "propertyeditorvalue.h"
|
#include "propertyeditorvalue.h"
|
||||||
#include "basiclayouts.h"
|
#include "basiclayouts.h"
|
||||||
#include "basicwidgets.h"
|
#include "basicwidgets.h"
|
||||||
|
|||||||
@@ -36,6 +36,9 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <variantproperty.h>
|
||||||
|
#include <nodelistproperty.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
debug = false
|
debug = false
|
||||||
};
|
};
|
||||||
@@ -434,6 +437,21 @@ void StatesEditorView::scriptFunctionsChanged(const ModelNode &node, const QStri
|
|||||||
QmlModelView::scriptFunctionsChanged(node, scriptFunctionList);
|
QmlModelView::scriptFunctionsChanged(node, scriptFunctionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StatesEditorView::nodeIdChanged(const ModelNode &/*node*/, const QString &/*newId*/, const QString &/*oldId*/)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatesEditorView::bindingPropertiesChanged(const QList<BindingProperty> &/*propertyList*/, PropertyChangeFlags /*propertyChange*/)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatesEditorView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/, const QList<ModelNode> &/*lastSelectedNodeList*/)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QPixmap StatesEditorView::renderState(int i)
|
QPixmap StatesEditorView::renderState(int i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ public:
|
|||||||
|
|
||||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
void nodeIdChanged(const ModelNode &node, const QString &newId, const QString &oldId);
|
||||||
|
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList, PropertyChangeFlags propertyChange);
|
||||||
|
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ namespace QmlDesigner {
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class QmlModelView;
|
class QmlModelView;
|
||||||
|
class NodeInstanceView;
|
||||||
|
|
||||||
class CORESHARED_EXPORT AbstractView : public QObject
|
class CORESHARED_EXPORT AbstractView : public QObject
|
||||||
{
|
{
|
||||||
@@ -101,6 +102,8 @@ public:
|
|||||||
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList);
|
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList);
|
||||||
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
|
|
||||||
|
void emitInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
virtual void modelAttached(Model *model);
|
virtual void modelAttached(Model *model);
|
||||||
virtual void modelAboutToBeDetached(Model *model);
|
virtual void modelAboutToBeDetached(Model *model);
|
||||||
|
|
||||||
@@ -115,6 +118,8 @@ public:
|
|||||||
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) = 0;
|
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) = 0;
|
||||||
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) = 0;
|
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) = 0;
|
||||||
|
|
||||||
|
virtual void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList) = 0;
|
||||||
|
|
||||||
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||||
const QList<ModelNode> &lastSelectedNodeList) = 0;
|
const QList<ModelNode> &lastSelectedNodeList) = 0;
|
||||||
|
|
||||||
@@ -135,6 +140,8 @@ public:
|
|||||||
|
|
||||||
void changeRootNodeType(const QString &type, int majorVersion, int minorVersion);
|
void changeRootNodeType(const QString &type, int majorVersion, int minorVersion);
|
||||||
|
|
||||||
|
NodeInstanceView *nodeInstanceView() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setModel(Model * model);
|
void setModel(Model * model);
|
||||||
void removeModel();
|
void removeModel();
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ public:
|
|||||||
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
||||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
|
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
|
|
||||||
QList<NodeInstance> instances() const;
|
QList<NodeInstance> instances() const;
|
||||||
@@ -100,9 +101,6 @@ public:
|
|||||||
|
|
||||||
void notifyPropertyChange(const ModelNode &modelNode, const QString &propertyName);
|
void notifyPropertyChange(const ModelNode &modelNode, const QString &propertyName);
|
||||||
|
|
||||||
void setQmlModelView(QmlModelView *qmlModelView);
|
|
||||||
QmlModelView *qmlModelView() const ;
|
|
||||||
|
|
||||||
void setBlockStatePropertyChanges(bool block);
|
void setBlockStatePropertyChanges(bool block);
|
||||||
|
|
||||||
NodeInstance activeStateInstance() const;
|
NodeInstance activeStateInstance() const;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#define QMLMODELVIEW_H
|
#define QMLMODELVIEW_H
|
||||||
|
|
||||||
#include <corelib_global.h>
|
#include <corelib_global.h>
|
||||||
#include <forwardview.h>
|
|
||||||
#include <abstractview.h>
|
#include <abstractview.h>
|
||||||
#include "qmlitemnode.h"
|
#include "qmlitemnode.h"
|
||||||
#include "qmlstate.h"
|
#include "qmlstate.h"
|
||||||
@@ -42,7 +41,7 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
class ItemLibraryEntry;
|
class ItemLibraryEntry;
|
||||||
|
|
||||||
class CORESHARED_EXPORT QmlModelView : public ForwardView<NodeInstanceView>
|
class CORESHARED_EXPORT QmlModelView : public AbstractView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend CORESHARED_EXPORT class QmlObjectNode;
|
friend CORESHARED_EXPORT class QmlObjectNode;
|
||||||
@@ -90,10 +89,26 @@ public:
|
|||||||
|
|
||||||
virtual void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
|
virtual void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
|
||||||
|
|
||||||
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
|
void nodeCreated(const ModelNode &createdNode);
|
||||||
|
void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
|
||||||
|
void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
|
||||||
|
void propertiesAboutToBeRemoved(const QList<AbstractProperty> &propertyList);
|
||||||
|
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
||||||
|
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
||||||
|
void nodeAboutToBeRemoved(const ModelNode &removedNode);
|
||||||
|
void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId);
|
||||||
|
void propertiesRemoved(const QList<AbstractProperty>& propertyList);
|
||||||
|
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||||
|
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||||
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NodeInstance instanceForModelNode(const ModelNode &modelNode);
|
NodeInstance instanceForModelNode(const ModelNode &modelNode);
|
||||||
bool hasInstanceForModelNode(const ModelNode &modelNode);
|
bool hasInstanceForModelNode(const ModelNode &modelNode);
|
||||||
NodeInstanceView *nodeInstanceView() const;
|
|
||||||
virtual void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName) ;
|
virtual void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName) ;
|
||||||
virtual void parentChanged(const QmlObjectNode &qmlObjectNode);
|
virtual void parentChanged(const QmlObjectNode &qmlObjectNode);
|
||||||
virtual void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
|
virtual void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ public:
|
|||||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
|
||||||
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
void importAdded(const Import &import);
|
void importAdded(const Import &import);
|
||||||
void importRemoved(const Import &import);
|
void importRemoved(const Import &import);
|
||||||
|
|
||||||
|
|||||||
@@ -379,6 +379,12 @@ void NodeInstanceView::scriptFunctionsChanged(const ModelNode &/*node*/, const Q
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeInstanceView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//\}
|
//\}
|
||||||
|
|
||||||
void NodeInstanceView::loadNodes(const QList<ModelNode> &nodeList)
|
void NodeInstanceView::loadNodes(const QList<ModelNode> &nodeList)
|
||||||
@@ -557,22 +563,10 @@ void NodeInstanceView::notifyPropertyChange(const ModelNode &node, const QString
|
|||||||
if (m_blockStatePropertyChanges)
|
if (m_blockStatePropertyChanges)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (qmlModelView()) {
|
emitInstancePropertyChange(QList<QPair<ModelNode, QString> >() << qMakePair(node, propertyName));
|
||||||
qmlModelView()->nodeInstancePropertyChanged(ModelNode(node,qmlModelView()), propertyName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NodeInstanceView::setQmlModelView(QmlModelView *qmlModelView)
|
|
||||||
{
|
|
||||||
m_qmlModelView = qmlModelView;
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlModelView *NodeInstanceView::qmlModelView() const
|
|
||||||
{
|
|
||||||
return m_qmlModelView.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceView::setBlockStatePropertyChanges(bool block)
|
void NodeInstanceView::setBlockStatePropertyChanges(bool block)
|
||||||
{
|
{
|
||||||
m_blockStatePropertyChanges = block;
|
m_blockStatePropertyChanges = block;
|
||||||
|
|||||||
@@ -339,6 +339,15 @@ QmlModelView *AbstractView::toQmlModelView()
|
|||||||
return qobject_cast<QmlModelView*>(this);
|
return qobject_cast<QmlModelView*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NodeInstanceView *AbstractView::nodeInstanceView() const
|
||||||
|
{
|
||||||
|
if (model()) {
|
||||||
|
return model()->m_d->nodeInstanceView();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QList<ModelNode> AbstractView::allModelNodes()
|
QList<ModelNode> AbstractView::allModelNodes()
|
||||||
{
|
{
|
||||||
return toModelNodeList(model()->m_d->allNodes());
|
return toModelNodeList(model()->m_d->allNodes());
|
||||||
@@ -359,6 +368,12 @@ void AbstractView::emitCustomNotification(const QString &identifier, const QList
|
|||||||
model()->m_d->notifyCustomNotification(this, identifier, nodeList, data);
|
model()->m_d->notifyCustomNotification(this, identifier, nodeList, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractView::emitInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList)
|
||||||
|
{
|
||||||
|
if (model())
|
||||||
|
model()->m_d->notifyInstancePropertyChange(propertyList);
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractView::changeRootNodeType(const QString &type, int majorVersion, int minorVersion)
|
void AbstractView::changeRootNodeType(const QString &type, int majorVersion, int minorVersion)
|
||||||
{
|
{
|
||||||
Internal::WriteLocker locker(m_model.data());
|
Internal::WriteLocker locker(m_model.data());
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
#include "abstractview.h"
|
#include "abstractview.h"
|
||||||
#include "widgetqueryview.h"
|
#include "nodeinstanceview.h"
|
||||||
#include "metainfo.h"
|
#include "metainfo.h"
|
||||||
#include "model_p.h"
|
#include "model_p.h"
|
||||||
#include "modelutilities.h"
|
#include "modelutilities.h"
|
||||||
@@ -88,14 +88,13 @@ namespace Internal {
|
|||||||
|
|
||||||
ModelPrivate::ModelPrivate(Model *model) :
|
ModelPrivate::ModelPrivate(Model *model) :
|
||||||
m_q(model),
|
m_q(model),
|
||||||
m_rootInternalNode(createNode("Qt/Rectangle", 4, 7, PropertyListType())),
|
|
||||||
m_writeLock(false)
|
m_writeLock(false)
|
||||||
{
|
{
|
||||||
|
m_rootInternalNode = createNode("Qt/Item", 4, 7, PropertyListType());
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPrivate::~ModelPrivate()
|
ModelPrivate::~ModelPrivate()
|
||||||
{
|
{
|
||||||
|
|
||||||
detachAllViews();
|
detachAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,16 +134,55 @@ void ModelPrivate::removeImport(const Import &import)
|
|||||||
notifyImportRemoved(import);
|
notifyImportRemoved(import);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPrivate::notifyImportAdded(const Import &import) const
|
void ModelPrivate::notifyImportAdded(const Import &import)
|
||||||
{
|
{
|
||||||
|
bool resetModel = false;
|
||||||
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
rewriterView()->importAdded(import);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rewriterView())
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList)
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList)
|
||||||
view->importAdded(import);
|
view->importAdded(import);
|
||||||
|
|
||||||
|
if (nodeInstanceView())
|
||||||
|
nodeInstanceView()->importAdded(import);
|
||||||
|
|
||||||
|
if (resetModel) {
|
||||||
|
resetModelByRewriter(description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelPrivate::notifyImportRemoved(const Import &import) const
|
void ModelPrivate::notifyImportRemoved(const Import &import)
|
||||||
{
|
{
|
||||||
|
bool resetModel = false;
|
||||||
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
rewriterView()->importRemoved(import);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList)
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList)
|
||||||
view->importRemoved(import);
|
view->importRemoved(import);
|
||||||
|
|
||||||
|
if (nodeInstanceView())
|
||||||
|
nodeInstanceView()->importRemoved(import);
|
||||||
|
|
||||||
|
if (resetModel) {
|
||||||
|
resetModelByRewriter(description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl ModelPrivate::fileUrl() const
|
QUrl ModelPrivate::fileUrl() const
|
||||||
@@ -286,15 +324,26 @@ void ModelPrivate::notifyAuxiliaryDataChanged(const InternalNodePointer &interna
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
ModelNode node(internalNode, model(), rewriterView());
|
||||||
|
rewriterView()->auxiliaryDataChanged(node, name, data);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
ModelNode node(internalNode, model(), view.data());
|
ModelNode node(internalNode, model(), view.data());
|
||||||
try {
|
view->auxiliaryDataChanged(node, name, data);
|
||||||
view->auxiliaryDataChanged(node, name, data);
|
|
||||||
} catch (RewritingException &e) {
|
}
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
if (nodeInstanceView()) {
|
||||||
}
|
ModelNode node(internalNode, model(), nodeInstanceView());
|
||||||
|
nodeInstanceView()->auxiliaryDataChanged(node, name, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
@@ -307,35 +356,68 @@ void ModelPrivate::notifyRootNodeTypeChanged(const QString &type, int majorVersi
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView())
|
||||||
|
rewriterView()->rootNodeTypeChanged(type, majorVersion, minorVersion);
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
try {
|
view->rootNodeTypeChanged(type, majorVersion, minorVersion);
|
||||||
view->rootNodeTypeChanged(type, majorVersion, minorVersion);
|
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView())
|
||||||
|
nodeInstanceView()->rootNodeTypeChanged(type, majorVersion, minorVersion);
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelPrivate::notifyInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyPairList)
|
||||||
|
{
|
||||||
|
// no need to notify the rewriter or the instance view
|
||||||
|
|
||||||
|
typedef QPair<ModelNode, QString> ModelNodePropertyPair;
|
||||||
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
|
Q_ASSERT(view != 0);
|
||||||
|
|
||||||
|
QList<QPair<ModelNode, QString> > adaptedPropertyList;
|
||||||
|
foreach (const ModelNodePropertyPair &propertyPair, propertyPairList) {
|
||||||
|
ModelNodePropertyPair newPair(ModelNode(propertyPair.first.internalNode(), model(), view.data()), propertyPair.second);
|
||||||
|
adaptedPropertyList.append(newPair);
|
||||||
|
}
|
||||||
|
|
||||||
|
view->instancePropertyChange(adaptedPropertyList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
|
void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
|
||||||
{
|
{
|
||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
QList<Internal::InternalNode::Pointer> internalList(toInternalNodeList(nodeList));
|
QList<Internal::InternalNode::Pointer> internalList(toInternalNodeList(nodeList));
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView())
|
||||||
|
rewriterView()->customNotification(senderView, identifier, toModelNodeList(internalList, rewriterView()), data);
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
try {
|
view->customNotification(senderView, identifier, toModelNodeList(internalList, view.data()), data);
|
||||||
view->customNotification(senderView, identifier, toModelNodeList(internalList, view.data()), data);
|
}
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
if (nodeInstanceView()) {
|
||||||
resetModel = true;
|
rewriterView()->customNotification(senderView, identifier, toModelNodeList(internalList, nodeInstanceView()), data);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
@@ -349,6 +431,33 @@ void ModelPrivate::notifyPropertiesRemoved(const QList<PropertyPair> &propertyPa
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
QList<AbstractProperty> propertyList;
|
||||||
|
foreach (const PropertyPair &propertyPair, propertyPairList) {
|
||||||
|
AbstractProperty newProperty(propertyPair.second, propertyPair.first, model(), rewriterView());
|
||||||
|
propertyList.append(newProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
rewriterView()->propertiesRemoved(propertyList);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
QList<AbstractProperty> propertyList;
|
||||||
|
foreach (const PropertyPair &propertyPair, propertyPairList) {
|
||||||
|
AbstractProperty newProperty(propertyPair.second, propertyPair.first, model(), nodeInstanceView());
|
||||||
|
propertyList.append(newProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeInstanceView()->propertiesRemoved(propertyList);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
QList<AbstractProperty> propertyList;
|
QList<AbstractProperty> propertyList;
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
@@ -356,12 +465,8 @@ void ModelPrivate::notifyPropertiesRemoved(const QList<PropertyPair> &propertyPa
|
|||||||
AbstractProperty newProperty(propertyPair.second, propertyPair.first, model(), view.data());
|
AbstractProperty newProperty(propertyPair.second, propertyPair.first, model(), view.data());
|
||||||
propertyList.append(newProperty);
|
propertyList.append(newProperty);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
view->propertiesRemoved(propertyList);
|
view->propertiesRemoved(propertyList);
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
@@ -374,6 +479,23 @@ void ModelPrivate::notifyPropertiesAboutToBeRemoved(const QList<InternalProperty
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
QList<AbstractProperty> propertyList;
|
||||||
|
foreach (const InternalProperty::Pointer &property, internalPropertyList) {
|
||||||
|
AbstractProperty newProperty(property->name(), property->propertyOwner(), model(), rewriterView());
|
||||||
|
propertyList.append(newProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
rewriterView()->propertiesAboutToBeRemoved(propertyList);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
QList<AbstractProperty> propertyList;
|
QList<AbstractProperty> propertyList;
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
@@ -389,6 +511,16 @@ void ModelPrivate::notifyPropertiesAboutToBeRemoved(const QList<InternalProperty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
QList<AbstractProperty> propertyList;
|
||||||
|
foreach (const InternalProperty::Pointer &property, internalPropertyList) {
|
||||||
|
AbstractProperty newProperty(property->name(), property->propertyOwner(), model(), nodeInstanceView());
|
||||||
|
propertyList.append(newProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeInstanceView()->propertiesAboutToBeRemoved(propertyList);
|
||||||
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -437,17 +569,28 @@ void ModelPrivate::notifyNodeCreated(const InternalNode::Pointer &newInternalNod
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
ModelNode createdNode(newInternalNodePointer, model(), rewriterView());
|
||||||
|
rewriterView()->nodeCreated(createdNode);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
ModelNode createdNode(newInternalNodePointer, model(), view.data());
|
ModelNode createdNode(newInternalNodePointer, model(), view.data());
|
||||||
|
view->nodeCreated(createdNode);
|
||||||
try {
|
|
||||||
view->nodeCreated(createdNode);
|
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
ModelNode createdNode(newInternalNodePointer, model(), nodeInstanceView());
|
||||||
|
nodeInstanceView()->nodeCreated(createdNode);
|
||||||
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -458,16 +601,28 @@ void ModelPrivate::notifyNodeAboutToBeRemoved(const InternalNode::Pointer &nodeP
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
ModelNode node(nodePointer, model(), rewriterView());
|
||||||
|
rewriterView()->nodeAboutToBeRemoved(node);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
ModelNode node(nodePointer, model(), nodeInstanceView());
|
||||||
|
nodeInstanceView()->nodeAboutToBeRemoved(node);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
ModelNode node(nodePointer, model(), view.data());
|
ModelNode node(nodePointer, model(), view.data());
|
||||||
try {
|
view->nodeAboutToBeRemoved(node);
|
||||||
view->nodeAboutToBeRemoved(node);
|
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -478,17 +633,31 @@ void ModelPrivate::notifyNodeRemoved(const InternalNodePointer &nodePointer, con
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
ModelNode node(nodePointer, model(), rewriterView());
|
||||||
|
NodeAbstractProperty parentProperty(parentPropertyName, parentNodePointer, model(), rewriterView());
|
||||||
|
rewriterView()->nodeRemoved(node, parentProperty, propertyChange);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
ModelNode node(nodePointer, model(), nodeInstanceView());
|
||||||
|
NodeAbstractProperty parentProperty(parentPropertyName, parentNodePointer, model(), nodeInstanceView());
|
||||||
|
nodeInstanceView()->nodeRemoved(node, parentProperty, propertyChange);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
ModelNode node(nodePointer, model(), view.data());
|
ModelNode node(nodePointer, model(), view.data());
|
||||||
NodeAbstractProperty parentProperty(parentPropertyName, parentNodePointer, model(), view.data());
|
NodeAbstractProperty parentProperty(parentPropertyName, parentNodePointer, model(), view.data());
|
||||||
try {
|
view->nodeRemoved(node, parentProperty, propertyChange);
|
||||||
view->nodeRemoved(node, parentProperty, propertyChange);
|
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -499,16 +668,27 @@ void ModelPrivate::notifyNodeIdChanged(const InternalNode::Pointer& nodePointer,
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
ModelNode node(nodePointer, model(), rewriterView());
|
||||||
|
rewriterView()->nodeIdChanged(node, newId, oldId);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
ModelNode node(nodePointer, model(), view.data());
|
ModelNode node(nodePointer, model(), view.data());
|
||||||
try {
|
view->nodeIdChanged(node, newId, oldId);
|
||||||
view->nodeIdChanged(node, newId, oldId);
|
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
ModelNode node(nodePointer, model(), nodeInstanceView());
|
||||||
|
nodeInstanceView()->nodeIdChanged(node, newId, oldId);
|
||||||
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -519,19 +699,37 @@ void ModelPrivate::notifyBindingPropertiesChanged(const QList<InternalBindingPro
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
QList<BindingProperty> propertyList;
|
||||||
|
foreach (const InternalBindingPropertyPointer &bindingProperty, internalBropertyList) {
|
||||||
|
propertyList.append(BindingProperty(bindingProperty->name(), bindingProperty->propertyOwner(), model(), rewriterView()));
|
||||||
|
}
|
||||||
|
rewriterView()->bindingPropertiesChanged(propertyList, propertyChange);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
QList<BindingProperty> propertyList;
|
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
|
QList<BindingProperty> propertyList;
|
||||||
foreach (const InternalBindingPropertyPointer &bindingProperty, internalBropertyList) {
|
foreach (const InternalBindingPropertyPointer &bindingProperty, internalBropertyList) {
|
||||||
propertyList.append(BindingProperty(bindingProperty->name(), bindingProperty->propertyOwner(), model(), view.data()));
|
propertyList.append(BindingProperty(bindingProperty->name(), bindingProperty->propertyOwner(), model(), view.data()));
|
||||||
}
|
}
|
||||||
try {
|
view->bindingPropertiesChanged(propertyList, propertyChange);
|
||||||
view->bindingPropertiesChanged(propertyList, propertyChange);
|
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
QList<BindingProperty> propertyList;
|
||||||
|
foreach (const InternalBindingPropertyPointer &bindingProperty, internalBropertyList) {
|
||||||
|
propertyList.append(BindingProperty(bindingProperty->name(), bindingProperty->propertyOwner(), model(), nodeInstanceView()));
|
||||||
|
}
|
||||||
|
nodeInstanceView()->bindingPropertiesChanged(propertyList, propertyChange);
|
||||||
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -542,18 +740,29 @@ void ModelPrivate::notifyScriptFunctionsChanged(const InternalNodePointer &inter
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
ModelNode node(internalNodePointer, model(), rewriterView());
|
||||||
|
rewriterView()->scriptFunctionsChanged(node, scriptFunctionList);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
ModelNode node(internalNodePointer, model(), nodeInstanceView());
|
||||||
|
nodeInstanceView()->scriptFunctionsChanged(node, scriptFunctionList);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
|
|
||||||
|
|
||||||
ModelNode node(internalNodePointer, model(), view.data());
|
ModelNode node(internalNodePointer, model(), view.data());
|
||||||
try {
|
view->scriptFunctionsChanged(node, scriptFunctionList);
|
||||||
view->scriptFunctionsChanged(node, scriptFunctionList);
|
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -565,6 +774,25 @@ void ModelPrivate::notifyVariantPropertiesChanged(const InternalNodePointer &int
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
QList<VariantProperty> propertyList;
|
||||||
|
foreach (const QString &propertyName, propertyNameList) {
|
||||||
|
Q_ASSERT(internalNodePointer->hasProperty(propertyName));
|
||||||
|
Q_ASSERT(internalNodePointer->property(propertyName)->isVariantProperty());
|
||||||
|
VariantProperty property(propertyName, internalNodePointer, model(), rewriterView());
|
||||||
|
propertyList.append(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelNode node(internalNodePointer, model(), rewriterView());
|
||||||
|
rewriterView()->variantPropertiesChanged(propertyList, propertyChange);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
QList<VariantProperty> propertyList;
|
QList<VariantProperty> propertyList;
|
||||||
Q_ASSERT(view != 0);
|
Q_ASSERT(view != 0);
|
||||||
@@ -575,13 +803,23 @@ void ModelPrivate::notifyVariantPropertiesChanged(const InternalNodePointer &int
|
|||||||
propertyList.append(property);
|
propertyList.append(property);
|
||||||
}
|
}
|
||||||
ModelNode node(internalNodePointer, model(), view.data());
|
ModelNode node(internalNodePointer, model(), view.data());
|
||||||
try {
|
view->variantPropertiesChanged(propertyList, propertyChange);
|
||||||
view->variantPropertiesChanged(propertyList, propertyChange);
|
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
QList<VariantProperty> propertyList;
|
||||||
|
foreach (const QString &propertyName, propertyNameList) {
|
||||||
|
Q_ASSERT(internalNodePointer->hasProperty(propertyName));
|
||||||
|
Q_ASSERT(internalNodePointer->property(propertyName)->isVariantProperty());
|
||||||
|
VariantProperty property(propertyName, internalNodePointer, model(), nodeInstanceView());
|
||||||
|
propertyList.append(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelNode node(internalNodePointer, model(), nodeInstanceView());
|
||||||
|
nodeInstanceView()->variantPropertiesChanged(propertyList, propertyChange);
|
||||||
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -592,6 +830,24 @@ void ModelPrivate::notifyNodeReparent(const InternalNode::Pointer &internalNodeP
|
|||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
QString description;
|
QString description;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView()) {
|
||||||
|
NodeAbstractProperty newProperty;
|
||||||
|
NodeAbstractProperty oldProperty;
|
||||||
|
|
||||||
|
if (!oldPropertyName.isEmpty() && oldParent->isValid())
|
||||||
|
oldProperty = NodeAbstractProperty(oldPropertyName, oldParent, model(), rewriterView());
|
||||||
|
|
||||||
|
if (!newPropertyParent.isNull())
|
||||||
|
newProperty = NodeAbstractProperty(newPropertyParent, model(), rewriterView());
|
||||||
|
ModelNode node(internalNodePointer, model(), rewriterView());
|
||||||
|
rewriterView()->nodeReparented(node, newProperty, oldProperty, propertyChange);
|
||||||
|
}
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
NodeAbstractProperty newProperty;
|
NodeAbstractProperty newProperty;
|
||||||
NodeAbstractProperty oldProperty;
|
NodeAbstractProperty oldProperty;
|
||||||
@@ -603,13 +859,24 @@ void ModelPrivate::notifyNodeReparent(const InternalNode::Pointer &internalNodeP
|
|||||||
if (!newPropertyParent.isNull())
|
if (!newPropertyParent.isNull())
|
||||||
newProperty = NodeAbstractProperty(newPropertyParent, model(), view.data());
|
newProperty = NodeAbstractProperty(newPropertyParent, model(), view.data());
|
||||||
ModelNode node(internalNodePointer, model(), view.data());
|
ModelNode node(internalNodePointer, model(), view.data());
|
||||||
try {
|
|
||||||
view->nodeReparented(node, newProperty, oldProperty, propertyChange);
|
view->nodeReparented(node, newProperty, oldProperty, propertyChange);
|
||||||
} catch (RewritingException &e) {
|
|
||||||
description = e.description();
|
|
||||||
resetModel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
NodeAbstractProperty newProperty;
|
||||||
|
NodeAbstractProperty oldProperty;
|
||||||
|
|
||||||
|
if (!oldPropertyName.isEmpty() && oldParent->isValid())
|
||||||
|
oldProperty = NodeAbstractProperty(oldPropertyName, oldParent, model(), nodeInstanceView());
|
||||||
|
|
||||||
|
if (!newPropertyParent.isNull())
|
||||||
|
newProperty = NodeAbstractProperty(newPropertyParent, model(), nodeInstanceView());
|
||||||
|
ModelNode node(internalNodePointer, model(), nodeInstanceView());
|
||||||
|
nodeInstanceView()->nodeReparented(node, newProperty, oldProperty, propertyChange);
|
||||||
|
}
|
||||||
|
|
||||||
if (resetModel) {
|
if (resetModel) {
|
||||||
resetModelByRewriter(description);
|
resetModelByRewriter(description);
|
||||||
}
|
}
|
||||||
@@ -895,6 +1162,45 @@ void ModelPrivate::setRootNode(const InternalNode::Pointer& newRootNode)
|
|||||||
notifyNodeCreated(m_rootInternalNode);
|
notifyNodeCreated(m_rootInternalNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelPrivate::setRewriterView(RewriterView *rewriterView)
|
||||||
|
{
|
||||||
|
if (rewriterView == m_rewriterView.data())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_ASSERT(!(rewriterView && m_rewriterView));
|
||||||
|
|
||||||
|
m_rewriterView = rewriterView;
|
||||||
|
|
||||||
|
if (rewriterView)
|
||||||
|
rewriterView->modelAttached(model());
|
||||||
|
else if (m_rewriterView)
|
||||||
|
m_rewriterView->modelAboutToBeDetached(model());
|
||||||
|
}
|
||||||
|
|
||||||
|
RewriterView *ModelPrivate::rewriterView() const
|
||||||
|
{
|
||||||
|
return m_rewriterView.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelPrivate::setNodeInstanceView(NodeInstanceView *nodeInstanceView)
|
||||||
|
{
|
||||||
|
if (nodeInstanceView == m_nodeInstanceView.data())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_ASSERT(!(nodeInstanceView && m_nodeInstanceView));
|
||||||
|
|
||||||
|
m_nodeInstanceView = nodeInstanceView;
|
||||||
|
|
||||||
|
if (nodeInstanceView)
|
||||||
|
nodeInstanceView->modelAttached(m_q);
|
||||||
|
else if (m_nodeInstanceView)
|
||||||
|
m_nodeInstanceView->modelAttached(m_q);
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeInstanceView *ModelPrivate::nodeInstanceView() const
|
||||||
|
{
|
||||||
|
return m_nodeInstanceView.data();
|
||||||
|
}
|
||||||
|
|
||||||
InternalNodePointer ModelPrivate::nodeForId(const QString &id) const
|
InternalNodePointer ModelPrivate::nodeForId(const QString &id) const
|
||||||
{
|
{
|
||||||
@@ -1144,6 +1450,18 @@ The view is informed that it has been registered within the model by a call to A
|
|||||||
void Model::attachView(AbstractView *view)
|
void Model::attachView(AbstractView *view)
|
||||||
{
|
{
|
||||||
// Internal::WriteLocker locker(m_d);
|
// Internal::WriteLocker locker(m_d);
|
||||||
|
RewriterView *rewriterView = qobject_cast<RewriterView*>(view);
|
||||||
|
if (rewriterView) {
|
||||||
|
m_d->setRewriterView(rewriterView);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeInstanceView *nodeInstanceView = qobject_cast<NodeInstanceView*>(view);
|
||||||
|
if (nodeInstanceView) {
|
||||||
|
m_d->setNodeInstanceView(nodeInstanceView);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_d->attachView(view);
|
m_d->attachView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1159,6 +1477,19 @@ void Model::detachView(AbstractView *view, ViewNotification emitDetachNotify)
|
|||||||
{
|
{
|
||||||
// Internal::WriteLocker locker(m_d);
|
// Internal::WriteLocker locker(m_d);
|
||||||
bool emitNotify = (emitDetachNotify == NotifyView);
|
bool emitNotify = (emitDetachNotify == NotifyView);
|
||||||
|
|
||||||
|
RewriterView *rewriterView = qobject_cast<RewriterView*>(view);
|
||||||
|
if (rewriterView) {
|
||||||
|
m_d->setRewriterView(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeInstanceView *nodeInstanceView = qobject_cast<NodeInstanceView*>(view);
|
||||||
|
if (nodeInstanceView) {
|
||||||
|
m_d->setNodeInstanceView(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_d->detachView(view, emitNotify);
|
m_d->detachView(view, emitNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ QT_END_NAMESPACE
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class AbstractProperty;
|
class AbstractProperty;
|
||||||
|
class RewriterView;
|
||||||
|
class NodeInstanceView;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -140,6 +141,7 @@ public:
|
|||||||
void notifyRootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
void notifyRootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
||||||
|
|
||||||
void notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
|
void notifyInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -160,8 +162,8 @@ public:
|
|||||||
QList<Import> imports() const { return m_imports; }
|
QList<Import> imports() const { return m_imports; }
|
||||||
void addImport(const Import &import);
|
void addImport(const Import &import);
|
||||||
void removeImport(const Import &import);
|
void removeImport(const Import &import);
|
||||||
void notifyImportAdded(const Import &import) const;
|
void notifyImportAdded(const Import &import);
|
||||||
void notifyImportRemoved(const Import &import) const;
|
void notifyImportRemoved(const Import &import);
|
||||||
|
|
||||||
|
|
||||||
//node state property manipulation
|
//node state property manipulation
|
||||||
@@ -190,6 +192,11 @@ public:
|
|||||||
|
|
||||||
WriteLocker createWriteLocker() const;
|
WriteLocker createWriteLocker() const;
|
||||||
|
|
||||||
|
void setRewriterView(RewriterView *rewriterView);
|
||||||
|
RewriterView *rewriterView() const;
|
||||||
|
void setNodeInstanceView(NodeInstanceView *nodeInstanceView);
|
||||||
|
NodeInstanceView *nodeInstanceView() const;
|
||||||
|
|
||||||
private: //functions
|
private: //functions
|
||||||
void removePropertyWithoutNotification(const InternalPropertyPointer &property);
|
void removePropertyWithoutNotification(const InternalPropertyPointer &property);
|
||||||
void removeAllSubNodes(const InternalNodePointer &node);
|
void removeAllSubNodes(const InternalNodePointer &node);
|
||||||
@@ -212,7 +219,8 @@ private:
|
|||||||
QUrl m_fileUrl;
|
QUrl m_fileUrl;
|
||||||
|
|
||||||
QWeakPointer<Model> m_masterModel;
|
QWeakPointer<Model> m_masterModel;
|
||||||
|
QWeakPointer<RewriterView> m_rewriterView;
|
||||||
|
QWeakPointer<NodeInstanceView> m_nodeInstanceView;
|
||||||
bool m_writeLock;
|
bool m_writeLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include "nodeabstractproperty.h"
|
||||||
|
#include "variantproperty.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
debug = false
|
debug = false
|
||||||
@@ -47,11 +49,8 @@ enum {
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
QmlModelView::QmlModelView(QObject *parent)
|
QmlModelView::QmlModelView(QObject *parent)
|
||||||
: ForwardView<NodeInstanceView>(parent)
|
: AbstractView(parent)
|
||||||
{
|
{
|
||||||
NodeInstanceView *nodeInstanceView = new NodeInstanceView(this);
|
|
||||||
nodeInstanceView->setQmlModelView(this);
|
|
||||||
appendView(nodeInstanceView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlModelView::setCurrentState(const QmlModelState &state)
|
void QmlModelView::setCurrentState(const QmlModelState &state)
|
||||||
@@ -302,23 +301,18 @@ bool QmlModelView::hasInstanceForModelNode(const ModelNode &modelNode)
|
|||||||
return nodeInstanceView()->hasInstanceForNode(modelNode);
|
return nodeInstanceView()->hasInstanceForNode(modelNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeInstanceView *QmlModelView::nodeInstanceView() const
|
|
||||||
{
|
|
||||||
return firstView();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlModelView::modelAttached(Model *model)
|
void QmlModelView::modelAttached(Model *model)
|
||||||
{
|
{
|
||||||
|
AbstractView::modelAttached(model);
|
||||||
m_state = QmlModelState();
|
m_state = QmlModelState();
|
||||||
ForwardView<NodeInstanceView>::modelAttached(model);
|
|
||||||
m_state = baseState();
|
m_state = baseState();
|
||||||
Q_ASSERT(m_state.isBaseState());
|
Q_ASSERT(m_state.isBaseState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlModelView::modelAboutToBeDetached(Model *model)
|
void QmlModelView::modelAboutToBeDetached(Model *model)
|
||||||
{
|
{
|
||||||
ForwardView<NodeInstanceView>::modelAboutToBeDetached(model);
|
|
||||||
m_state = QmlModelState();
|
m_state = QmlModelState();
|
||||||
|
AbstractView::modelAboutToBeDetached(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isTransformProperty(const QString &name)
|
static bool isTransformProperty(const QString &name)
|
||||||
@@ -335,6 +329,32 @@ static bool isTransformProperty(const QString &name)
|
|||||||
return transformProperties.contains(name);
|
return transformProperties.contains(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlModelView::nodeOrderChanged(const NodeListProperty &/*listProperty*/, const ModelNode &/*movedNode*/, int /*oldIndex*/)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlModelView::nodeCreated(const ModelNode &/*createdNode*/) {}
|
||||||
|
void QmlModelView::nodeAboutToBeRemoved(const ModelNode &/*removedNode*/) {}
|
||||||
|
void QmlModelView::nodeRemoved(const ModelNode &/*removedNode*/, const NodeAbstractProperty &/*parentProperty*/, PropertyChangeFlags /*propertyChange*/) {}
|
||||||
|
void QmlModelView::nodeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/) {}
|
||||||
|
void QmlModelView::nodeIdChanged(const ModelNode& /*node*/, const QString& /*newId*/, const QString& /*oldId*/) {}
|
||||||
|
void QmlModelView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& /*propertyList*/) {}
|
||||||
|
void QmlModelView::propertiesRemoved(const QList<AbstractProperty>& /*propertyList*/) {}
|
||||||
|
void QmlModelView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
|
||||||
|
void QmlModelView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
|
||||||
|
void QmlModelView::rootNodeTypeChanged(const QString &/*type*/, int, int /*minorVersion*/) {}
|
||||||
|
void QmlModelView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
|
||||||
|
void QmlModelView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/, const QList<ModelNode> &/*lastSelectedNodeList*/) {}
|
||||||
|
|
||||||
|
void QmlModelView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList)
|
||||||
|
{
|
||||||
|
typedef QPair<ModelNode, QString> ModelNodePropertyPair;
|
||||||
|
foreach (const ModelNodePropertyPair &propertyPair, propertyList) {
|
||||||
|
nodeInstancePropertyChanged(propertyPair.first, propertyPair.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QmlModelView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName)
|
void QmlModelView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include "nodeinstanceview.h"
|
#include "nodeinstanceview.h"
|
||||||
#include "nodeinstance.h"
|
#include "nodeinstance.h"
|
||||||
#include "nodemetainfo.h"
|
#include "nodemetainfo.h"
|
||||||
|
#include "bindingproperty.h"
|
||||||
|
#include "nodelistproperty.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <metainfo.h>
|
#include <metainfo.h>
|
||||||
#include <invalidmodelnodeexception.h>
|
#include <invalidmodelnodeexception.h>
|
||||||
|
#include "bindingproperty.h"
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|||||||
@@ -356,6 +356,11 @@ void RewriterView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStri
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RewriterView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RewriterView::selectedNodesChanged(const QList<ModelNode> & /* selectedNodeList, */, const QList<ModelNode> & /*lastSelectedNodeList */)
|
void RewriterView::selectedNodesChanged(const QList<ModelNode> & /* selectedNodeList, */, const QList<ModelNode> & /*lastSelectedNodeList */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,15 @@ void ViewLogger::customNotification(const AbstractView *view, const QString &ide
|
|||||||
void ViewLogger::scriptFunctionsChanged(const ModelNode &node, const QStringList &/*scriptFunctionList*/)
|
void ViewLogger::scriptFunctionsChanged(const ModelNode &node, const QStringList &/*scriptFunctionList*/)
|
||||||
{
|
{
|
||||||
m_output << time() << indent("function scripts changed:") << node << endl;
|
m_output << time() << indent("function scripts changed:") << node << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewLogger::instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList)
|
||||||
|
{
|
||||||
|
typedef QPair<ModelNode, QString> PropertyPair;
|
||||||
|
m_output << time() << indent("instancePropertyChange:") << endl;
|
||||||
|
|
||||||
|
foreach(const PropertyPair &propertyPair, propertyList)
|
||||||
|
m_output << time() << indent("property: ") << propertyPair.first << propertyPair.second << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public:
|
|||||||
|
|
||||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString time() const;
|
QString time() const;
|
||||||
|
|||||||
@@ -259,12 +259,14 @@ void DesignModeWidget::showEditor(Core::IEditor *editor)
|
|||||||
} else {
|
} else {
|
||||||
DesignDocumentController *newDocument = new DesignDocumentController(this);
|
DesignDocumentController *newDocument = new DesignDocumentController(this);
|
||||||
|
|
||||||
|
newDocument->setNodeInstanceView(m_nodeInstanceView.data());
|
||||||
newDocument->setAllPropertiesBox(m_allPropertiesBox.data());
|
newDocument->setAllPropertiesBox(m_allPropertiesBox.data());
|
||||||
newDocument->setNavigator(m_navigator.data());
|
newDocument->setNavigator(m_navigator.data());
|
||||||
newDocument->setStatesEditorWidget(m_statesEditorWidget.data());
|
newDocument->setStatesEditorWidget(m_statesEditorWidget.data());
|
||||||
newDocument->setItemLibrary(m_itemLibrary.data());
|
newDocument->setItemLibrary(m_itemLibrary.data());
|
||||||
newDocument->setFormEditorView(m_formEditorView.data());
|
newDocument->setFormEditorView(m_formEditorView.data());
|
||||||
|
|
||||||
|
|
||||||
newDocument->setFileName(fileName);
|
newDocument->setFileName(fileName);
|
||||||
|
|
||||||
document = newDocument;
|
document = newDocument;
|
||||||
@@ -620,6 +622,7 @@ void DesignModeWidget::setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_nodeInstanceView = new NodeInstanceView(this);
|
||||||
// Sidebar takes ownership
|
// Sidebar takes ownership
|
||||||
m_navigator = new NavigatorView;
|
m_navigator = new NavigatorView;
|
||||||
m_allPropertiesBox = new AllPropertiesBox;
|
m_allPropertiesBox = new AllPropertiesBox;
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ private:
|
|||||||
QWeakPointer<AllPropertiesBox> m_allPropertiesBox;
|
QWeakPointer<AllPropertiesBox> m_allPropertiesBox;
|
||||||
QWeakPointer<StatesEditorWidget> m_statesEditorWidget;
|
QWeakPointer<StatesEditorWidget> m_statesEditorWidget;
|
||||||
QWeakPointer<FormEditorView> m_formEditorView;
|
QWeakPointer<FormEditorView> m_formEditorView;
|
||||||
|
QWeakPointer<NodeInstanceView> m_nodeInstanceView;
|
||||||
|
|
||||||
bool m_syncWithTextEdit;
|
bool m_syncWithTextEdit;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user