Commit da5f9117 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Thomas Hartmann

QmlDesigner: Add default implementations to AbstractView

This allows us to remove empty implementations in the views.

Change-Id: I65f815dc5bd699d3b8a782881a2cdd5b01fb76ee
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent ed49f548
...@@ -188,50 +188,49 @@ public: ...@@ -188,50 +188,49 @@ public:
virtual void modelAttached(Model *model); virtual void modelAttached(Model *model);
virtual void modelAboutToBeDetached(Model *model); virtual void modelAboutToBeDetached(Model *model);
virtual void nodeCreated(const ModelNode &createdNode) = 0; virtual void nodeCreated(const ModelNode &createdNode);
virtual void nodeAboutToBeRemoved(const ModelNode &removedNode) = 0; virtual void nodeAboutToBeRemoved(const ModelNode &removedNode);
virtual void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange) = 0; virtual void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
virtual void nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange) = 0; virtual void nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
virtual void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange) = 0; virtual void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
virtual void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId) = 0; virtual void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId);
virtual void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList) = 0; virtual void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList);
virtual void propertiesRemoved(const QList<AbstractProperty>& propertyList) = 0; virtual void propertiesRemoved(const QList<AbstractProperty>& propertyList);
virtual void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) = 0; virtual void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) = 0; virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) = 0; virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange);
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) = 0; virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
virtual void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) = 0; virtual void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
virtual void instancesCompleted(const QVector<ModelNode> &completedNodeList) = 0;
virtual void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash) = 0;
virtual void instancesRenderImageChanged(const QVector<ModelNode> &nodeList) = 0;
virtual void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList) = 0;
virtual void instancesChildrenChanged(const QVector<ModelNode> &nodeList) = 0;
virtual void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector) = 0;
virtual void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource) = 0;
virtual void rewriterBeginTransaction() = 0;
virtual void rewriterEndTransaction() = 0;
virtual void currentStateChanged(const ModelNode &node) = 0; // base state is a invalid model node
virtual void instanceErrorChange(const QVector<ModelNode> &errorNodeList); virtual void instanceErrorChange(const QVector<ModelNode> &errorNodeList);
virtual void instancesCompleted(const QVector<ModelNode> &completedNodeList);
virtual void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
virtual void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
virtual void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
virtual void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
virtual void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
virtual void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
virtual void rewriterBeginTransaction();
virtual void rewriterEndTransaction();
virtual void currentStateChanged(const ModelNode &node); // base state is a invalid model node
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList) = 0; const QList<ModelNode> &lastSelectedNodeList);
virtual void fileUrlChanged(const QUrl &oldUrl, const QUrl &newUrl); virtual void fileUrlChanged(const QUrl &oldUrl, const QUrl &newUrl);
virtual void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex) = 0; virtual void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
virtual void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports) = 0; virtual void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports);
virtual void auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data); virtual void auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data);
virtual void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data); virtual void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) = 0; virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion); void changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion);
......
...@@ -193,17 +193,63 @@ void AbstractView::modelAboutToBeDetached(Model *) ...@@ -193,17 +193,63 @@ void AbstractView::modelAboutToBeDetached(Model *)
Empty properties were removed. Empty properties were removed.
*/ */
void AbstractView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/)
{
}
void AbstractView::instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &/*informationChangeHash*/)
{
}
void AbstractView::instancesRenderImageChanged(const QVector<ModelNode> &/*nodeList*/)
{
}
void AbstractView::instancesPreviewImageChanged(const QVector<ModelNode> &/*nodeList*/)
{
}
void AbstractView::instancesChildrenChanged(const QVector<ModelNode> &/*nodeList*/)
{
}
void AbstractView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
{
}
void AbstractView::nodeSourceChanged(const ModelNode &/*modelNode*/, const QString &/*newNodeSource*/)
{
}
void AbstractView::rewriterBeginTransaction()
{
}
void AbstractView::rewriterEndTransaction()
{
}
void AbstractView::instanceErrorChange(const QVector<ModelNode> &/*errorNodeList*/) void AbstractView::instanceErrorChange(const QVector<ModelNode> &/*errorNodeList*/)
{ {
} }
void AbstractView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/)
{
}
// Node related functions // Node related functions
/*! /*!
\fn void AbstractView::nodeCreated(const ModelNode &createdNode) \fn void AbstractView::nodeCreated(const ModelNode &createdNode)
Called when the new node \a createdNode is created. Called when the new node \a createdNode is created.
*/ */
void AbstractView::nodeCreated(const ModelNode &/*createdNode*/)
{
}
void AbstractView::currentStateChanged(const ModelNode &/*node*/)
{
}
/*! /*!
Called when the file URL (that is needed to resolve relative paths against, Called when the file URL (that is needed to resolve relative paths against,
...@@ -213,10 +259,25 @@ void AbstractView::fileUrlChanged(const QUrl &/*oldUrl*/, const QUrl &/*newUrl*/ ...@@ -213,10 +259,25 @@ void AbstractView::fileUrlChanged(const QUrl &/*oldUrl*/, const QUrl &/*newUrl*/
{ {
} }
void AbstractView::nodeOrderChanged(const NodeListProperty &/*listProperty*/, const ModelNode &/*movedNode*/, int /*oldIndex*/)
{
}
/*! /*!
\fn void AbstractView::nodeAboutToBeRemoved(const ModelNode &removedNode) \fn void AbstractView::nodeAboutToBeRemoved(const ModelNode &removedNode)
Called when the node specified by \a removedNode will be removed. Called when the node specified by \a removedNode will be removed.
*/ */
void AbstractView::nodeAboutToBeRemoved(const ModelNode &/*removedNode*/)
{
}
void AbstractView::nodeRemoved(const ModelNode &/*removedNode*/, const NodeAbstractProperty &/*parentProperty*/, PropertyChangeFlags /*propertyChange*/)
{
}
void AbstractView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& /*propertyList*/)
{
}
/*! /*!
Called when the properties specified by \a propertyList are removed. Called when the properties specified by \a propertyList are removed.
...@@ -237,16 +298,54 @@ Called when the parent of \a node will be changed from \a oldPropertyParent to ...@@ -237,16 +298,54 @@ Called when the parent of \a node will be changed from \a oldPropertyParent to
Called when the selection is changed from \a lastSelectedNodeList to Called when the selection is changed from \a lastSelectedNodeList to
\a selectedNodeList. \a selectedNodeList.
*/ */
void AbstractView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/, const QList<ModelNode> &/*lastSelectedNodeList*/)
{
}
void AbstractView::auxiliaryDataChanged(const ModelNode &/*node*/, const PropertyName &/*name*/, const QVariant &/*data*/) void AbstractView::nodeAboutToBeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
{ {
}
void AbstractView::nodeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
void AbstractView::nodeIdChanged(const ModelNode& /*node*/, const QString& /*newId*/, const QString& /*oldId*/)
{
}
void AbstractView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
{
}
void AbstractView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
{
}
void AbstractView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
{
}
void AbstractView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
{
}
void AbstractView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
{
}
void AbstractView::auxiliaryDataChanged(const ModelNode &/*node*/, const PropertyName &/*name*/, const QVariant &/*data*/)
{
} }
void AbstractView::customNotification(const AbstractView * /*view*/, const QString & /*identifier*/, const QList<ModelNode> & /*nodeList*/, const QList<QVariant> & /*data*/) void AbstractView::customNotification(const AbstractView * /*view*/, const QString & /*identifier*/, const QList<ModelNode> & /*nodeList*/, const QList<QVariant> & /*data*/)
{ {
} }
void AbstractView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/)
{
}
QList<ModelNode> AbstractView::toModelNodeList(const QList<Internal::InternalNode::Pointer> &nodeList) const QList<ModelNode> AbstractView::toModelNodeList(const QList<Internal::InternalNode::Pointer> &nodeList) const
{ {
return QmlDesigner::toModelNodeList(nodeList, const_cast<AbstractView*>(this)); return QmlDesigner::toModelNodeList(nodeList, const_cast<AbstractView*>(this));
......
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