1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef FXOBJECTNODE_H
35 #define FXOBJECTNODE_H
37 #include <corelib_global.h>
38 #include "qmlmodelnodefacade.h"
40 #include "qmlchangeset.h"
42 #include <nodeinstance.h>
44 namespace QmlDesigner {
47 class QmlPropertyChanges;
49 class CORESHARED_EXPORT QmlObjectNode : public QmlModelNodeFacade
52 QmlObjectNode() : QmlModelNodeFacade() {}
53 QmlObjectNode(const ModelNode &modelNode) : QmlModelNodeFacade(modelNode) {}
55 bool hasNodeParent() const;
56 bool hasInstanceParent() const;
57 void setParentProperty(const NodeAbstractProperty &parentProeprty);
58 QmlObjectNode instanceParent() const;
60 void setId(const QString &id);
64 QmlModelState currentState() const;
65 void setVariantProperty(const QString &name, const QVariant &value);
66 void setBindingProperty(const QString &name, const QString &expression);
67 NodeAbstractProperty nodeAbstractProperty(const QString &name) const;
68 NodeProperty nodeProperty(const QString &name) const;
69 NodeListProperty nodeListProperty(const QString &name) const;
71 QVariant instanceValue(const QString &name) const;
72 QString instanceType(const QString &name) const;
74 bool hasProperty(const QString &name) const;
75 bool hasBindingProperty(const QString &name) const;
76 bool instanceHasBinding(const QString &name) const;
77 bool propertyAffectedByCurrentState(const QString &name) const;
78 QVariant modelValue(const QString &name) const;
79 QString expression(const QString &name) const;
80 bool isInBaseState() const;
81 QmlPropertyChanges propertyChangeForCurrentState() const;
83 virtual bool canReparent() const;
85 bool isRootModelNode() const;
89 QList<QmlModelState> allAffectingStates() const;
90 QList<QmlModelStateOperation> allAffectingStatesOperations() const;
92 void removeVariantProperty(const QString &name);
94 void setParent(QmlObjectNode newParent);
96 QmlItemNode toQmlItemNode() const;
98 bool isAncestorOf(const QmlObjectNode &objectNode) const;
100 bool hasDefaultProperty() const;
101 QString defaultProperty() const;
103 static QVariant instanceValue(const ModelNode &modelNode, const QString &name);
106 NodeInstance nodeInstance() const;
107 QmlObjectNode nodeForInstance(const NodeInstance &instance) const;
110 QList<QmlModelState> allDefinedStates() const;
113 CORESHARED_EXPORT uint qHash(const QmlObjectNode &node);
114 CORESHARED_EXPORT QList<ModelNode> toModelNodeList(const QList<QmlObjectNode> &fxObjectNodeList);
115 CORESHARED_EXPORT QList<QmlObjectNode> toQmlObjectNodeList(const QList<ModelNode> &modelNodeList);
118 #endif // FXOBJECTNODE_H