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 DESIGNERMODEL_H
35 #define DESIGNERMODEL_H
37 #include <corelib_global.h>
38 #include <QtCore/QObject>
39 #include <QtCore/QMimeData>
40 #include <QtCore/QPair>
41 #include <QtDeclarative/QDeclarativeError>
49 namespace QmlDesigner {
59 class WidgetQueryView;
60 class NodeStateChangeSet;
65 class AbstractProperty;
68 typedef QList<QPair<QString, QVariant> > PropertyListType;
70 class CORESHARED_EXPORT Model : public QObject
72 friend class QmlDesigner::ModelNode;
73 friend class QmlDesigner::NodeState;
74 friend class QmlDesigner::ModelState;
75 friend class QmlDesigner::NodeAnchors;
76 friend class QmlDesigner::AbstractProperty;
77 friend class QmlDesigner::AbstractView;
78 friend class Internal::ModelPrivate;
83 enum ViewNotification { NotifyView, DoNotNotifyView };
87 static Model *create(QString type, int major = 4, int minor = 7);
89 Model *masterModel() const;
90 void setMasterModel(Model *model);
93 void setFileUrl(const QUrl &url);
95 const MetaInfo metaInfo() const;
97 NodeMetaInfo metaInfo(const QString &typeName, int majorVersion = -1, int minorVersion = -1);
98 void setMetaInfo(const MetaInfo &metaInfo);
100 void attachView(AbstractView *view);
101 void detachView(AbstractView *view, ViewNotification emitDetachNotify = NotifyView);
103 // Editing sub-components:
106 QList<Import> imports() const;
107 void addImport(const Import &import);
108 void removeImport(const Import &import);
110 RewriterView *rewriterView() const;
116 Internal::ModelPrivate *m_d;
121 #endif // DESIGNERMODEL_H