Commit 56de1574 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Refactor inline functions in QmlModelNodeFacade



Change-Id: I7408b6ad2a767eb944436c5cc62c87609aba8a69
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 3a0af1ce
......@@ -40,8 +40,9 @@ class QmlModelView;
class QMLDESIGNERCORE_EXPORT QmlModelNodeFacade
{
public:
operator ModelNode() const { return m_modelNode; }
ModelNode modelNode() const { return m_modelNode; }
operator ModelNode() const;
ModelNode modelNode();
const ModelNode modelNode() const;
virtual bool isValid() const;
virtual ~QmlModelNodeFacade();
QmlModelNodeFacade();
......
......@@ -136,7 +136,8 @@ void QmlAnchors::setAnchor(AnchorLine::Type sourceAnchorLine,
}
const PropertyName propertyName = anchorPropertyName(sourceAnchorLine);
QString targetExpression = targetQmlItemNode.modelNode().validId();
ModelNode targetModelNode = targetQmlItemNode.modelNode();
QString targetExpression = targetModelNode.validId();
if (targetQmlItemNode.modelNode() == qmlItemNode().modelNode().parentProperty().parentModelNode())
targetExpression = "parent";
if (sourceAnchorLine != AnchorLine::Center && sourceAnchorLine != AnchorLine::Fill)
......
......@@ -42,6 +42,21 @@ QmlModelNodeFacade::QmlModelNodeFacade(const ModelNode &modelNode) : m_modelNode
QmlModelNodeFacade::~QmlModelNodeFacade()
{}
QmlModelNodeFacade::operator ModelNode() const
{
return m_modelNode;
}
ModelNode QmlModelNodeFacade::modelNode()
{
return m_modelNode;
}
const ModelNode QmlModelNodeFacade::modelNode() const
{
return m_modelNode;
}
bool QmlModelNodeFacade::isValid() const
{
return modelNode().isValid() && qmlModelView() && qmlModelView()->nodeInstanceView() && qmlModelView()->hasInstanceForModelNode(modelNode()) && qmlModelView()->instanceForModelNode(modelNode()).isValid();
......
......@@ -254,7 +254,7 @@ QmlPropertyChanges QmlObjectNode::propertyChangeForCurrentState() const
static void removeStateOperationsForChildren(const QmlObjectNode &node)
{
if (node.isValid()) {
foreach (const QmlModelStateOperation &stateOperation, node.allAffectingStatesOperations()) {
foreach (QmlModelStateOperation stateOperation, node.allAffectingStatesOperations()) {
stateOperation.modelNode().destroy(); //remove of belonging StatesOperations
}
......@@ -275,7 +275,7 @@ void QmlObjectNode::destroy()
if (!isValid())
throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
foreach (const QmlModelStateOperation &stateOperation, allAffectingStatesOperations()) {
foreach (QmlModelStateOperation stateOperation, allAffectingStatesOperations()) {
stateOperation.modelNode().destroy(); //remove of belonging StatesOperations
}
removeStateOperationsForChildren(modelNode());
......
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