Commit bae48751 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: use one node instance view

Bauhaus now uses only one single instance view.

Done by Marco Bubke
parent 22a162a7
......@@ -51,6 +51,9 @@
#include <QDir>
#include <QAction>
#include <zoomaction.h>
#include <nodeabstractproperty.h>
#include <nodelistproperty.h>
namespace QmlDesigner {
......@@ -264,6 +267,9 @@ void FormEditorView::scriptFunctionsChanged(const ModelNode &node, const QString
QmlModelView::scriptFunctionsChanged(node, scriptFunctionList);
}
void FormEditorView::propertiesRemoved(const QList<AbstractProperty> &/*propertyList*/)
{
}
AbstractFormEditorTool* FormEditorView::currentTool() const
{
......
......@@ -78,6 +78,7 @@ public:
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList);
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void propertiesRemoved(const QList<AbstractProperty> &propertyList);
// FormEditorView
FormEditorWidget *widget() const;
......
......@@ -38,6 +38,7 @@
#include <QGraphicsSceneMouseEvent>
#include <QtDebug>
#include <QClipboard>
#include <variantproperty.h>
namespace QmlDesigner {
......
......@@ -42,6 +42,8 @@
#include <limits>
#include <model.h>
#include <qmlanchors.h>
#include <variantproperty.h>
#include <nodeabstractproperty.h>
namespace QmlDesigner {
......
......@@ -160,7 +160,7 @@ void ComponentView::variantPropertiesChanged(const QList<VariantProperty>& /*pro
void ComponentView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
void ComponentView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
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*/,
......
......@@ -67,7 +67,7 @@ public:
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList);
......
......@@ -50,6 +50,7 @@
#include <rewritingexception.h>
#include <nodelistproperty.h>
#include <toolbox.h>
#include <variantproperty.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
......@@ -87,6 +88,7 @@ public:
QWeakPointer<AllPropertiesBox> allPropertiesBox;
QWeakPointer<StatesEditorWidget> statesEditorWidget;
QWeakPointer<QStackedWidget> stackedWidget;
QWeakPointer<NodeInstanceView> nodeInstanceView;
QWeakPointer<QmlDesigner::Model> model;
QWeakPointer<QmlDesigner::Model> subComponentModel;
......@@ -212,6 +214,11 @@ void DesignDocumentController::setFormEditorView(FormEditorView *formEditorView)
m_d->formEditorView = formEditorView;
}
void DesignDocumentController::setNodeInstanceView(NodeInstanceView *nodeInstanceView)
{
m_d->nodeInstanceView = nodeInstanceView;
}
QString DesignDocumentController::displayName() const
{
if (fileName().isEmpty())
......@@ -344,6 +351,7 @@ void DesignDocumentController::loadCurrentModel()
Q_ASSERT(m_d->model);
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->itemLibrary->setItemLibraryInfo(m_d->model->metaInfo().itemLibraryInfo());
m_d->itemLibrary->setResourcePath(QFileInfo(m_d->fileName).absolutePath());
......
......@@ -94,6 +94,7 @@ public:
void setAllPropertiesBox(AllPropertiesBox* allPropertiesBox);
void setStatesEditorWidget(StatesEditorWidget* statesEditorWidget);
void setFormEditorView(FormEditorView *formEditorView);
void setNodeInstanceView(NodeInstanceView *nodeInstanceView);
signals:
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)
{
......
......@@ -58,6 +58,8 @@ public:
virtual void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
ModelNode insertModel(const ModelNode &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)
{
......
......@@ -81,7 +81,7 @@ public:
const QList<ModelNode> &lastSelectedNodeList);
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
private slots:
// void handleChangedItem(QStandardItem * item);
......
......@@ -40,6 +40,10 @@
#include <variantproperty.h>
#include <propertymetainfo.h>
#include <bindingproperty.h>
#include <nodeabstractproperty.h>
#include "propertyeditorvalue.h"
#include "basiclayouts.h"
#include "basicwidgets.h"
......
......@@ -36,6 +36,9 @@
#include <QDebug>
#include <math.h>
#include <variantproperty.h>
#include <nodelistproperty.h>
enum {
debug = false
};
......@@ -434,6 +437,21 @@ void StatesEditorView::scriptFunctionsChanged(const ModelNode &node, const QStri
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)
{
......
......@@ -76,6 +76,9 @@ public:
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 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:
......
......@@ -54,6 +54,7 @@ namespace QmlDesigner {
namespace QmlDesigner {
class QmlModelView;
class NodeInstanceView;
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, const QList<QVariant> &data);
void emitInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
virtual void modelAttached(Model *model);
virtual void modelAboutToBeDetached(Model *model);
......@@ -115,6 +118,8 @@ public:
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) = 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,
const QList<ModelNode> &lastSelectedNodeList) = 0;
......@@ -135,6 +140,8 @@ public:
void changeRootNodeType(const QString &type, int majorVersion, int minorVersion);
NodeInstanceView *nodeInstanceView() const;
protected:
void setModel(Model * model);
void removeModel();
......
......@@ -85,6 +85,7 @@ public:
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
QList<NodeInstance> instances() const;
......@@ -100,9 +101,6 @@ public:
void notifyPropertyChange(const ModelNode &modelNode, const QString &propertyName);
void setQmlModelView(QmlModelView *qmlModelView);
QmlModelView *qmlModelView() const ;
void setBlockStatePropertyChanges(bool block);
NodeInstance activeStateInstance() const;
......
......@@ -31,7 +31,6 @@
#define QMLMODELVIEW_H
#include <corelib_global.h>
#include <forwardview.h>
#include <abstractview.h>
#include "qmlitemnode.h"
#include "qmlstate.h"
......@@ -42,7 +41,7 @@ namespace QmlDesigner {
class ItemLibraryEntry;
class CORESHARED_EXPORT QmlModelView : public ForwardView<NodeInstanceView>
class CORESHARED_EXPORT QmlModelView : public AbstractView
{
Q_OBJECT
friend CORESHARED_EXPORT class QmlObjectNode;
......@@ -90,10 +89,26 @@ public:
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:
NodeInstance instanceForModelNode(const ModelNode &modelNode);
bool hasInstanceForModelNode(const ModelNode &modelNode);
NodeInstanceView *nodeInstanceView() const;
virtual void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName) ;
virtual void parentChanged(const QmlObjectNode &qmlObjectNode);
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 scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
void importAdded(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)
......@@ -557,21 +563,9 @@ void NodeInstanceView::notifyPropertyChange(const ModelNode &node, const QString
if (m_blockStatePropertyChanges)
return;
if (qmlModelView()) {
qmlModelView()->nodeInstancePropertyChanged(ModelNode(node,qmlModelView()), propertyName);
}
}
void NodeInstanceView::setQmlModelView(QmlModelView *qmlModelView)
{
m_qmlModelView = qmlModelView;
emitInstancePropertyChange(QList<QPair<ModelNode, QString> >() << qMakePair(node, propertyName));
}
QmlModelView *NodeInstanceView::qmlModelView() const
{
return m_qmlModelView.data();
}
void NodeInstanceView::setBlockStatePropertyChanges(bool block)
{
......
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