OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / tests / auto / qml / qmldesigner / testview.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
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
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
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.
24 **
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.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef TESTVIEW_H
35 #define TESTVIEW_H
36
37 #include <qmlmodelview.h>
38 #include <QVariant>
39 #include <QStringList>
40 #include <model.h>
41
42 class TestView : public QmlDesigner::QmlModelView
43 {
44     Q_OBJECT
45 public:
46     struct MethodCall {
47         MethodCall(const QString &n, const QStringList &args) :
48                 name(n), arguments(args)
49         {
50         }
51
52         QString name;
53         QStringList arguments;
54     };
55
56     TestView(QmlDesigner::Model *model);
57
58     void modelAttached(QmlDesigner::Model *model);
59     void modelAboutToBeDetached(QmlDesigner::Model *model);
60     void nodeCreated(const QmlDesigner::ModelNode &createdNode);
61     void nodeAboutToBeRemoved(const QmlDesigner::ModelNode &removedNode);
62     void nodeRemoved(const QmlDesigner::ModelNode &removedNode, const QmlDesigner::NodeAbstractProperty &parentProperty, AbstractView::PropertyChangeFlags propertyChange);
63     void nodeReparented(const QmlDesigner::ModelNode &node, const QmlDesigner::NodeAbstractProperty &newPropertyParent, const QmlDesigner::NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
64     void nodeIdChanged(const QmlDesigner::ModelNode& node, const QString& newId, const QString& oldId);
65     void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
66
67     void bindingPropertiesChanged(const QList<QmlDesigner::BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
68     void variantPropertiesChanged(const QList<QmlDesigner::VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
69     void propertiesAboutToBeRemoved(const QList<QmlDesigner::AbstractProperty> &propertyList);
70
71
72
73     void fileUrlChanged(const QUrl &oldBaseUrl, const QUrl &newBaseUrl);
74     void selectedNodesChanged(const QList<QmlDesigner::ModelNode> &selectedNodeList,
75                               const QList<QmlDesigner::ModelNode> &lastSelectedNodeList);
76
77     void nodeOrderChanged(const QmlDesigner::NodeListProperty &listProperty, const QmlDesigner::ModelNode &movedNode, int oldIndex);
78
79     void stateChanged(const QmlDesigner::QmlModelState &newQmlModelState, const QmlDesigner::QmlModelState &oldQmlModelState);
80
81     QList<MethodCall> &methodCalls();
82
83     QString lastFunction() const;
84
85     QmlDesigner::NodeInstanceView *nodeInstanceView() const;
86
87     QmlDesigner::NodeInstance instanceForModelNode(const QmlDesigner::ModelNode &modelNode);
88
89 private:
90     QList<MethodCall> m_methodCalls;
91     static QString serialize(AbstractView::PropertyChangeFlags change);
92 };
93
94 bool operator==(TestView::MethodCall call1, TestView::MethodCall call2);
95 QDebug operator<<(QDebug debug, TestView::MethodCall call);
96
97 #endif // TESTVIEW_H