1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
36 #include <corelib_global.h>
37 #include <modelnode.h>
38 #include "qmlobjectnode.h"
41 #include <QStringList>
45 namespace QmlDesigner {
47 class QmlModelStateGroup;
50 class CORESHARED_EXPORT QmlItemNode : public QmlObjectNode
52 friend class CORESHARED_EXPORT QmlAnchors;
54 QmlItemNode() : QmlObjectNode() {}
55 QmlItemNode(const ModelNode &modelNode) : QmlObjectNode(modelNode) {}
57 bool isRootNode() const;
59 QmlModelStateGroup states() const;
60 QList<QmlItemNode> children() const;
61 QList<QmlObjectNode> resources() const;
62 QList<QmlObjectNode> defaultPropertyChildren() const;
63 QList<QmlObjectNode> allDirectSubNodes() const;
64 QmlAnchors anchors() const;
66 bool hasChildren() const;
67 bool hasResources() const;
68 bool instanceHasAnchors() const;
69 bool hasShowContent() const;
71 bool canReparent() const;
72 bool instanceIsAnchoredBySibling() const;
73 bool instanceIsAnchoredByChildren() const;
74 bool instanceIsMovable() const;
75 bool instanceIsResizable() const;
76 bool instanceIsInPositioner() const;
78 QRectF instanceBoundingRect() const;
79 QTransform instanceTransform() const;
80 QTransform instanceSceneTransform() const;
81 QPointF instancePosition() const;
82 QSizeF instanceSize() const;
83 int instancePenWidth() const;
86 void paintInstance(QPainter *painter);
90 bool isSelected() const;
92 QString simplifiedTypeName() const;
94 const QList<QmlItemNode> allDirectSubModelNodes() const;
95 const QList<QmlItemNode> allSubModelNodes() const;
96 bool hasAnySubModelNodes() const;
99 CORESHARED_EXPORT uint qHash(const QmlItemNode &node);
101 class CORESHARED_EXPORT QmlModelStateGroup
103 friend class QmlItemNode;
104 friend class QmlModelView;
108 QmlModelStateGroup() : m_modelNode(ModelNode()) {}
110 ModelNode modelNode() const { return m_modelNode; }
111 QStringList names() const;
112 QList<QmlModelState> allStates() const;
113 QmlModelState state(const QString &name) const;
114 QmlModelState addState(const QString &name);
115 void removeState(const QString &name);
118 QmlModelStateGroup(const ModelNode &modelNode) : m_modelNode(modelNode) {}
121 ModelNode m_modelNode;
124 CORESHARED_EXPORT QList<ModelNode> toModelNodeList(const QList<QmlItemNode> &fxItemNodeList);
125 CORESHARED_EXPORT QList<QmlItemNode> toQmlItemNodeList(const QList<ModelNode> &modelNodeList);
130 #endif // QmlItemNode_H