forked from qt-creator/qt-creator
QmlDesigner: Cleanups to the AbstractView class
Change-Id: Ic8f82342cd6cb8ff14b3239efa7add62112898a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "materialeditorview.h"
|
||||
#include "rewritertransaction.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
@@ -12,7 +13,7 @@ class MaterialEditorTransaction : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MaterialEditorTransaction(QmlDesigner::MaterialEditorView *materialEditor);
|
||||
MaterialEditorTransaction(MaterialEditorView *materialEditor);
|
||||
|
||||
Q_INVOKABLE void start();
|
||||
Q_INVOKABLE void end();
|
||||
@@ -23,8 +24,8 @@ protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
|
||||
private:
|
||||
QmlDesigner::MaterialEditorView *m_materialEditor = nullptr;
|
||||
QmlDesigner::RewriterTransaction m_rewriterTransaction;
|
||||
MaterialEditorView *m_materialEditor = nullptr;
|
||||
RewriterTransaction m_rewriterTransaction;
|
||||
int m_timerId = -1;
|
||||
};
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "propertyeditorview.h"
|
||||
#include "rewritertransaction.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
@@ -11,7 +12,7 @@ class PropertyEditorTransaction : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PropertyEditorTransaction(QmlDesigner::PropertyEditorView *propertyEditor);
|
||||
PropertyEditorTransaction(PropertyEditorView *propertyEditor);
|
||||
|
||||
Q_INVOKABLE void start();
|
||||
Q_INVOKABLE void end();
|
||||
@@ -22,8 +23,8 @@ protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
|
||||
private:
|
||||
QmlDesigner::PropertyEditorView *m_propertyEditor;
|
||||
QmlDesigner::RewriterTransaction m_rewriterTransaction;
|
||||
PropertyEditorView *m_propertyEditor;
|
||||
RewriterTransaction m_rewriterTransaction;
|
||||
int m_timerId;
|
||||
};
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rewritertransaction.h"
|
||||
#include "textureeditorview.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
@@ -3,43 +3,35 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <qmldesignercorelib_global.h>
|
||||
|
||||
#include <model.h>
|
||||
#include <modelnode.h>
|
||||
#include <abstractproperty.h>
|
||||
#include <documentmessage.h>
|
||||
#include <rewritertransaction.h>
|
||||
#include "model.h"
|
||||
#include "modelnode.h"
|
||||
#include "qmldesignercorelib_global.h"
|
||||
#include <commondefines.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QVector3D>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStyle;
|
||||
class QToolButton;
|
||||
class QImage;
|
||||
class QPixmap;
|
||||
class QVector3D;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QmlDesigner {
|
||||
namespace Internal {
|
||||
class InternalNode;
|
||||
using InternalNodePointer = std::shared_ptr<InternalNode>;
|
||||
}
|
||||
}
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class AbstractProperty;
|
||||
class DocumentMessage;
|
||||
class ExternalDependenciesInterface;
|
||||
class NodeInstanceView;
|
||||
class RewriterView;
|
||||
class QmlModelState;
|
||||
class QmlTimeline;
|
||||
class ExternalDependenciesInterface;
|
||||
class RewriterTransaction;
|
||||
class RewriterView;
|
||||
|
||||
namespace Internal {
|
||||
class InternalNode;
|
||||
using InternalNodePointer = std::shared_ptr<InternalNode>;
|
||||
}
|
||||
|
||||
enum DesignerWidgetFlags {
|
||||
DisableOnError,
|
||||
@@ -75,18 +67,19 @@ public:
|
||||
Q_FLAGS(PropertyChangeFlag PropertyChangeFlags)
|
||||
|
||||
enum PropertyChangeFlag {
|
||||
NoAdditionalChanges = 0x0,
|
||||
PropertiesAdded = 0x1,
|
||||
NoAdditionalChanges = 0x0,
|
||||
PropertiesAdded = 0x1,
|
||||
EmptyPropertiesRemoved = 0x2
|
||||
};
|
||||
Q_DECLARE_FLAGS(PropertyChangeFlags, PropertyChangeFlag)
|
||||
|
||||
AbstractView(ExternalDependenciesInterface &externalDependencies)
|
||||
: m_externalDependencies{externalDependencies}
|
||||
{}
|
||||
|
||||
~AbstractView() override;
|
||||
|
||||
Model* model() const;
|
||||
Model *model() const;
|
||||
bool isAttached() const;
|
||||
|
||||
RewriterTransaction beginRewriterTransaction(const QByteArray &identifier);
|
||||
@@ -128,7 +121,7 @@ public:
|
||||
QList<ModelNode> allModelNodes() const;
|
||||
QList<ModelNode> allModelNodesOfType(const NodeMetaInfo &typeName) const;
|
||||
|
||||
void emitDocumentMessage(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings = QList<DocumentMessage>());
|
||||
void emitDocumentMessage(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings = {});
|
||||
void emitDocumentMessage(const QString &error);
|
||||
void emitCustomNotification(const QString &identifier);
|
||||
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList);
|
||||
@@ -156,19 +149,25 @@ public:
|
||||
|
||||
virtual void nodeCreated(const ModelNode &createdNode);
|
||||
virtual void nodeAboutToBeRemoved(const ModelNode &removedNode);
|
||||
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);
|
||||
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);
|
||||
virtual void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList);
|
||||
virtual void propertiesRemoved(const QList<AbstractProperty>& propertyList);
|
||||
virtual void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||
virtual void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty,
|
||||
PropertyChangeFlags propertyChange);
|
||||
virtual void nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent,
|
||||
const NodeAbstractProperty &oldPropertyParent, PropertyChangeFlags propertyChange);
|
||||
virtual void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent,
|
||||
const NodeAbstractProperty &oldPropertyParent, PropertyChangeFlags propertyChange);
|
||||
virtual void nodeIdChanged(const ModelNode &node, const QString &newId, const QString &oldId);
|
||||
virtual void propertiesAboutToBeRemoved(const QList<AbstractProperty> &propertyList);
|
||||
virtual void propertiesRemoved(const QList<AbstractProperty> &propertyList);
|
||||
virtual void variantPropertiesChanged(const QList<VariantProperty> &propertyList,
|
||||
PropertyChangeFlags propertyChange);
|
||||
virtual void bindingPropertiesAboutToBeChanged(const QList<BindingProperty> &propertyList);
|
||||
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||
virtual void signalDeclarationPropertiesChanged(const QVector<SignalDeclarationProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||
virtual void bindingPropertiesChanged(const QList<BindingProperty> &propertyList, PropertyChangeFlags propertyChange);
|
||||
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &propertyList,
|
||||
PropertyChangeFlags propertyChange);
|
||||
virtual void signalDeclarationPropertiesChanged(const QVector<SignalDeclarationProperty> &propertyList,
|
||||
PropertyChangeFlags propertyChange);
|
||||
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
||||
virtual void nodeTypeChanged(const ModelNode& node, const TypeName &type, int majorVersion, int minorVersion);
|
||||
virtual void nodeTypeChanged(const ModelNode &node, const TypeName &type, int majorVersion, int minorVersion);
|
||||
|
||||
virtual void instancePropertyChanged(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||
virtual void instanceErrorChanged(const QVector<ModelNode> &errorNodeList);
|
||||
@@ -245,7 +244,6 @@ public:
|
||||
int minorQtQuickVersion() const;
|
||||
|
||||
void resetView();
|
||||
|
||||
void resetPuppet();
|
||||
|
||||
virtual bool hasWidget() const;
|
||||
@@ -296,10 +294,9 @@ protected:
|
||||
const QString &feedbackDisplayName = QString(),
|
||||
DesignerWidgetFlags widgetFlags = DesignerWidgetFlags::DisableOnError);
|
||||
|
||||
private: //functions
|
||||
private:
|
||||
QList<ModelNode> toModelNodeList(const QList<Internal::InternalNodePointer> &nodeList) const;
|
||||
|
||||
private:
|
||||
QPointer<Model> m_model;
|
||||
ExternalDependenciesInterface &m_externalDependencies;
|
||||
bool m_enabled = true;
|
||||
@@ -308,5 +305,4 @@ private:
|
||||
|
||||
QMLDESIGNERCORE_EXPORT QList<Internal::InternalNodePointer> toInternalNodeList(const QList<ModelNode> &nodeList);
|
||||
QMLDESIGNERCORE_EXPORT QList<ModelNode> toModelNodeList(const QList<Internal::InternalNodePointer> &nodeList, AbstractView *view);
|
||||
|
||||
}
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "qmldesignercorelib_global.h"
|
||||
#include "abstractview.h"
|
||||
#include "modelcache.h"
|
||||
#include "rewritertransaction.h"
|
||||
|
||||
#include <modelnode.h>
|
||||
#include <nodeinstance.h>
|
||||
|
@@ -4,9 +4,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "qmldesignercorelib_global.h"
|
||||
#include "exception.h"
|
||||
#include "abstractview.h"
|
||||
#include "documentmessage.h"
|
||||
#include "rewritertransaction.h"
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include <QTimer>
|
||||
|
@@ -4,24 +4,23 @@
|
||||
#include "abstractview.h"
|
||||
|
||||
#include "auxiliarydataproperties.h"
|
||||
#include "bindingproperty.h"
|
||||
#include "internalnode_p.h"
|
||||
#include "model.h"
|
||||
#include "model_p.h"
|
||||
#include "internalnode_p.h"
|
||||
#include "nodeinstanceview.h"
|
||||
#include <qmlstate.h>
|
||||
#include <qmltimeline.h>
|
||||
#include <nodemetainfo.h>
|
||||
#include <qmldesignerconstants.h>
|
||||
#include <nodelistproperty.h>
|
||||
#include <variantproperty.h>
|
||||
#include <bindingproperty.h>
|
||||
#include "nodelistproperty.h"
|
||||
#include "nodemetainfo.h"
|
||||
#include "qmlstate.h"
|
||||
#include "qmltimeline.h"
|
||||
#include "qmldesignerconstants.h"
|
||||
#include "rewritertransaction.h"
|
||||
#include "variantproperty.h"
|
||||
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui/qimage.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
@@ -78,35 +77,27 @@ ModelNode AbstractView::createModelNode(const TypeName &typeName,
|
||||
ModelNode::NodeSourceType nodeSourceType,
|
||||
const QString &behaviorPropertyName)
|
||||
{
|
||||
return ModelNode(model()->d->createNode(typeName, majorVersion, minorVersion, propertyList, auxPropertyList, nodeSource, nodeSourceType, behaviorPropertyName), model(), this);
|
||||
return ModelNode(model()->d->createNode(typeName, majorVersion, minorVersion, propertyList,
|
||||
auxPropertyList, nodeSource, nodeSourceType,
|
||||
behaviorPropertyName), model(), this);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the constant root model node.
|
||||
*/
|
||||
|
||||
// Returns the constant root model node.
|
||||
ModelNode AbstractView::rootModelNode() const
|
||||
{
|
||||
Q_ASSERT(model());
|
||||
return ModelNode(model()->d->rootNode(), model(), const_cast<AbstractView*>(this));
|
||||
return ModelNode(model()->d->rootNode(), model(), const_cast<AbstractView *>(this));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the root model node.
|
||||
*/
|
||||
|
||||
// Returns the root model node.
|
||||
ModelNode AbstractView::rootModelNode()
|
||||
{
|
||||
Q_ASSERT(model());
|
||||
return ModelNode(model()->d->rootNode(), model(), this);
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the reference to a model to a null pointer.
|
||||
|
||||
*/
|
||||
// Sets the reference to a model to a null pointer.
|
||||
void AbstractView::removeModel()
|
||||
{
|
||||
m_model.clear();
|
||||
@@ -133,9 +124,7 @@ WidgetInfo AbstractView::createWidgetInfo(QWidget *widget,
|
||||
return widgetInfo;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the model of the view.
|
||||
*/
|
||||
// Returns the model of the view.
|
||||
Model* AbstractView::model() const
|
||||
{
|
||||
return m_model.data();
|
||||
@@ -187,7 +176,6 @@ void AbstractView::modelAboutToBeDetached(Model *)
|
||||
\value EmptyPropertiesRemoved
|
||||
Empty properties were removed.
|
||||
*/
|
||||
|
||||
void AbstractView::instancePropertyChanged(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/)
|
||||
{
|
||||
}
|
||||
@@ -261,72 +249,60 @@ void AbstractView::nodeOrderChanged(const NodeListProperty &listProperty, const
|
||||
nodeOrderChanged(listProperty);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void AbstractView::nodeAboutToBeRemoved(const ModelNode &removedNode)
|
||||
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::nodeRemoved(const ModelNode &/*removedNode*/, const NodeAbstractProperty &/*parentProperty*/,
|
||||
PropertyChangeFlags /*propertyChange*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& /*propertyList*/)
|
||||
void AbstractView::propertiesAboutToBeRemoved(const QList<AbstractProperty> &/*propertyList*/)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Called when the properties specified by \a propertyList are removed.
|
||||
*/
|
||||
void AbstractView::propertiesRemoved(const QList<AbstractProperty>& /*propertyList*/)
|
||||
void AbstractView::propertiesRemoved(const QList<AbstractProperty> &/*propertyList*/)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange)
|
||||
Called when the parent of \a node will be changed from \a oldPropertyParent to
|
||||
\a newPropertyParent.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QmlDesigner::AbstractView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||
const QList<ModelNode> &lastSelectedNodeList)
|
||||
Called when the selection is changed from \a lastSelectedNodeList to
|
||||
\a selectedNodeList.
|
||||
*/
|
||||
void AbstractView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/, const QList<ModelNode> &/*lastSelectedNodeList*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::nodeAboutToBeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
|
||||
void AbstractView::nodeAboutToBeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/,
|
||||
const NodeAbstractProperty &/*oldPropertyParent*/, PropertyChangeFlags /*propertyChange*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::nodeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
|
||||
void AbstractView::nodeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/,
|
||||
const NodeAbstractProperty &/*oldPropertyParent*/, PropertyChangeFlags /*propertyChange*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::nodeIdChanged(const ModelNode& /*node*/, const QString& /*newId*/, const QString& /*oldId*/)
|
||||
void AbstractView::nodeIdChanged(const ModelNode &/*node*/, const QString &/*newId*/, const QString &/*oldId*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
|
||||
void AbstractView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/,
|
||||
PropertyChangeFlags /*propertyChange*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::bindingPropertiesAboutToBeChanged(const QList<BindingProperty> &) {}
|
||||
|
||||
void AbstractView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
|
||||
void AbstractView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/,
|
||||
PropertyChangeFlags /*propertyChange*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
|
||||
void AbstractView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &/*propertyList*/,
|
||||
PropertyChangeFlags /*propertyChange*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::signalDeclarationPropertiesChanged(const QVector<SignalDeclarationProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
|
||||
void AbstractView::signalDeclarationPropertiesChanged(const QVector<SignalDeclarationProperty> &/*propertyList*/,
|
||||
PropertyChangeFlags /*propertyChange*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -351,13 +327,14 @@ void AbstractView::usedImportsChanged(const QList<Import> &/*usedImports*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::auxiliaryDataChanged(const ModelNode & /*node*/,
|
||||
void AbstractView::auxiliaryDataChanged(const ModelNode &/*node*/,
|
||||
AuxiliaryDataKeyView /*key*/,
|
||||
const QVariant & /*data*/)
|
||||
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*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -369,27 +346,27 @@ void AbstractView::documentMessagesChanged(const QList<DocumentMessage> &/*error
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::currentTimelineChanged(const ModelNode & /*node*/)
|
||||
void AbstractView::currentTimelineChanged(const ModelNode &/*node*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::renderImage3DChanged(const QImage & /*image*/)
|
||||
void AbstractView::renderImage3DChanged(const QImage &/*image*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::updateActiveScene3D(const QVariantMap & /*sceneState*/)
|
||||
void AbstractView::updateActiveScene3D(const QVariantMap &/*sceneState*/)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::updateImport3DSupport(const QVariantMap & /*supportMap*/)
|
||||
void AbstractView::updateImport3DSupport(const QVariantMap &/*supportMap*/)
|
||||
{
|
||||
}
|
||||
|
||||
// a Quick3DNode that is picked at the requested view position in the 3D Editor and the 3D scene
|
||||
// position of the requested view position.
|
||||
void AbstractView::nodeAtPosReady(const ModelNode & /*modelNode*/, const QVector3D &/*pos3d*/) {}
|
||||
void AbstractView::nodeAtPosReady(const ModelNode &/*modelNode*/, const QVector3D &/*pos3d*/) {}
|
||||
|
||||
void AbstractView::modelNodePreviewPixmapChanged(const ModelNode & /*node*/, const QPixmap & /*pixmap*/)
|
||||
void AbstractView::modelNodePreviewPixmapChanged(const ModelNode &/*node*/, const QPixmap &/*pixmap*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -448,9 +425,6 @@ void AbstractView::setSelectedModelNode(const ModelNode &modelNode)
|
||||
setSelectedModelNodes({modelNode});
|
||||
}
|
||||
|
||||
/*!
|
||||
Clears the selection.
|
||||
*/
|
||||
void AbstractView::clearSelectedModelNodes()
|
||||
{
|
||||
model()->d->clearSelectedNodes();
|
||||
@@ -471,10 +445,6 @@ bool AbstractView::isSelectedModelNode(const ModelNode &modelNode) const
|
||||
return model()->d->selectedNodes().contains(modelNode.internalNode());
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the list of nodes to the actual selected nodes. Returns a list of the
|
||||
selected nodes.
|
||||
*/
|
||||
QList<ModelNode> AbstractView::selectedModelNodes() const
|
||||
{
|
||||
return toModelNodeList(model()->d->selectedNodes());
|
||||
@@ -496,18 +466,12 @@ ModelNode AbstractView::singleSelectedModelNode() const
|
||||
return ModelNode();
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds \a node to the selection list.
|
||||
*/
|
||||
void AbstractView::selectModelNode(const ModelNode &modelNode)
|
||||
{
|
||||
QTC_ASSERT(modelNode.isInHierarchy(), return);
|
||||
model()->d->selectNode(modelNode.internalNode());
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes \a node from the selection list.
|
||||
*/
|
||||
void AbstractView::deselectModelNode(const ModelNode &node)
|
||||
{
|
||||
model()->d->deselectNode(node.internalNode());
|
||||
@@ -537,22 +501,23 @@ const NodeInstanceView *AbstractView::nodeInstanceView() const
|
||||
{
|
||||
if (model())
|
||||
return model()->d->nodeInstanceView();
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RewriterView *AbstractView::rewriterView() const
|
||||
{
|
||||
if (model())
|
||||
return model()->d->rewriterView();
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void AbstractView::resetView()
|
||||
{
|
||||
if (!model())
|
||||
return;
|
||||
|
||||
Model *currentModel = model();
|
||||
|
||||
currentModel->detachView(this);
|
||||
@@ -630,7 +595,7 @@ void AbstractView::deactivateTimelineRecording()
|
||||
model()->d->notifyCurrentTimelineChanged(ModelNode());
|
||||
}
|
||||
|
||||
bool AbstractView::executeInTransaction(const QByteArray &identifier, const AbstractView::OperationBlock &lambda)
|
||||
bool AbstractView::executeInTransaction(const QByteArray &identifier, const OperationBlock &lambda)
|
||||
{
|
||||
try {
|
||||
RewriterTransaction transaction = beginRewriterTransaction(identifier);
|
||||
@@ -907,7 +872,7 @@ ModelNode AbstractView::currentStateNode() const
|
||||
if (model())
|
||||
return ModelNode(m_model.data()->d->currentStateNode(), m_model.data(), const_cast<AbstractView*>(this));
|
||||
|
||||
return ModelNode();
|
||||
return {};
|
||||
}
|
||||
|
||||
QmlModelState AbstractView::currentState() const
|
||||
@@ -917,12 +882,13 @@ QmlModelState AbstractView::currentState() const
|
||||
|
||||
QmlTimeline AbstractView::currentTimeline() const
|
||||
{
|
||||
if (model())
|
||||
if (model()) {
|
||||
return QmlTimeline(ModelNode(m_model.data()->d->currentTimelineNode(),
|
||||
m_model.data(),
|
||||
const_cast<AbstractView*>(this)));
|
||||
m_model.data(),
|
||||
const_cast<AbstractView *>(this)));
|
||||
}
|
||||
|
||||
return QmlTimeline();
|
||||
return {};
|
||||
}
|
||||
|
||||
static int getMinorVersionFromImport(const Model *model)
|
||||
@@ -962,13 +928,14 @@ static int getMajorVersionFromNode(const ModelNode &modelNode)
|
||||
if (modelNode.metaInfo().isValid()) {
|
||||
for (const NodeMetaInfo &info : modelNode.metaInfo().classHierarchy()) {
|
||||
if (info.typeName() == "QtQml.QtObject"
|
||||
|| info.typeName() == "QtQuick.QtObject"
|
||||
|| info.typeName() == "QtQuick.Item")
|
||||
|| info.typeName() == "QtQuick.QtObject"
|
||||
|| info.typeName() == "QtQuick.Item") {
|
||||
return info.majorVersion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1; //default
|
||||
return 1; // default
|
||||
}
|
||||
|
||||
static int getMinorVersionFromNode(const ModelNode &modelNode)
|
||||
@@ -981,7 +948,7 @@ static int getMinorVersionFromNode(const ModelNode &modelNode)
|
||||
}
|
||||
}
|
||||
|
||||
return 1; //default
|
||||
return 1; // default
|
||||
}
|
||||
|
||||
int AbstractView::majorQtQuickVersion() const
|
||||
@@ -1002,5 +969,4 @@ int AbstractView::minorQtQuickVersion() const
|
||||
return getMinorVersionFromNode(rootModelNode());
|
||||
}
|
||||
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "qmlchangeset.h"
|
||||
#include "bindingproperty.h"
|
||||
#include "rewritertransaction.h"
|
||||
#include "variantproperty.h"
|
||||
#include "abstractview.h"
|
||||
#include <metainfo.h>
|
||||
|
Reference in New Issue
Block a user