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 QmlPropertyView_h
35 #define QmlPropertyView_h
37 #include <qmlmodelview.h>
38 #include <declarativewidgetview.h>
40 #include <QDeclarativePropertyMap>
41 #include <QStackedWidget>
44 #include "qmlanchorbindingproxy.h"
45 #include "designerpropertymap.h"
46 #include "propertyeditorvalue.h"
47 #include "propertyeditorcontextobject.h"
55 class PropertyEditorValue;
57 namespace QmlDesigner {
59 class PropertyEditorTransaction;
63 class PropertyEditor: public QmlModelView
69 NodeType(PropertyEditor *propertyEditor);
72 void setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
73 void initialSetup(const QString &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
74 void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value);
76 DeclarativeWidgetView *m_view;
77 Internal::QmlAnchorBindingProxy m_backendAnchorBinding;
78 DesignerPropertyMap<PropertyEditorValue> m_backendValuesPropertyMap;
79 QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction;
80 QScopedPointer<PropertyEditorValue> m_dummyPropertyEditorValue;
81 QScopedPointer<PropertyEditorContextObject> m_contextObject;
85 PropertyEditor(QWidget *parent = 0);
88 void setQmlDir(const QString &qmlDirPath);
90 QWidget* createPropertiesPage();
92 void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
93 const QList<ModelNode> &lastSelectedNodeList);
94 void nodeAboutToBeRemoved(const ModelNode &removedNode);
96 void propertiesAdded(const NodeState &state, const QList<NodeProperty>& propertyList);
97 void propertiesRemoved(const QList<AbstractProperty>& propertyList);
98 void propertyValuesChanged(const NodeState &state, const QList<NodeProperty>& propertyList);
100 void modelAttached(Model *model);
102 void modelAboutToBeDetached(Model *model);
104 ModelState modelState() const;
106 void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
107 void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
109 void instanceInformationsChange(const QVector<ModelNode> &nodeList);
111 void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId);
112 void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
115 void timerEvent(QTimerEvent *event);
116 void otherPropertyChanged(const QmlObjectNode &, const QString &propertyName);
117 void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
118 void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
120 void setupPane(const QString &typeName);
121 void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value);
125 void changeValue(const QString &name);
126 void changeExpression(const QString &name);
131 QString qmlFileName(const NodeMetaInfo &nodeInfo) const;
132 QUrl fileToUrl(const QString &filePath) const;
133 QUrl qmlForNode(const ModelNode &modelNode, QString &className) const;
134 QString locateQmlFile(const QString &relativePath) const;
135 void select(const ModelNode& node);
138 void delayedResetView();
142 ModelNode m_selectedNode;
144 QShortcut *m_updateShortcut;
146 StackedWidget* m_stackedWidget;
148 QHash<QString, NodeType *> m_typeHash;
149 NodeType *m_currentType;
151 bool m_setupCompleted;
152 QTimer *m_singleShotTimer;
156 class StackedWidget : public QStackedWidget
161 StackedWidget(QWidget *parent = 0) : QStackedWidget(parent) {}
166 void resizeEvent(QResizeEvent * event)
168 QStackedWidget::resizeEvent(event);
174 #endif // QmlPropertyView_h