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 FORMEDITORVIEW_H
35 #define FORMEDITORVIEW_H
37 #include <qmlmodelview.h>
41 class QGraphicsSceneMouseEvent;
44 namespace QmlDesigner {
46 class FormEditorWidget;
47 class FormEditorNodeInstanceView;
48 class FormEditorScene;
49 class NodeInstanceView;
51 class AbstractFormEditorTool;
57 class ItemCreatorTool;
58 class ItemLibraryEntry;
61 class FormEditorView : public QmlModelView
66 FormEditorView(QObject *parent);
70 void modelAttached(Model *model);
71 void modelAboutToBeDetached(Model *model);
73 void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports);
75 void nodeCreated(const ModelNode &createdNode);
76 void nodeAboutToBeRemoved(const ModelNode &removedNode);
77 void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
78 void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId);
79 void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList);
80 void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
81 void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
82 void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
84 void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
85 const QList<ModelNode> &lastSelectedNodeList);
86 void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
87 void propertiesRemoved(const QList<AbstractProperty> &propertyList);
90 FormEditorWidget *widget() const;
91 AbstractFormEditorTool *currentTool() const;
92 FormEditorScene *scene() const;
94 bool changeToMoveTool();
95 bool changeToMoveTool(const QPointF &beginPoint);
96 void changeToDragTool();
97 void changeToSelectionTool();
98 void changeToItemCreatorTool();
99 void changeToSelectionTool(QGraphicsSceneMouseEvent *event);
100 void changeToResizeTool();
101 void changeToAnchorTool();
102 void changeToTransformTools();
104 void setCursor(const QCursor &cursor);
106 void nodeSlidedToIndex(const NodeListProperty &listProperty, int newIndex, int oldIndex);
107 void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
109 void instancesCompleted(const QVector<ModelNode> &completedNodeList);
110 void instanceInformationsChange(const QVector<ModelNode> &nodeList);
111 void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
112 void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
113 void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
115 void rewriterBeginTransaction();
116 void rewriterEndTransaction();
118 double margins() const;
119 double spacing() const;
120 void deActivateItemCreator();
123 void activateItemCreator(const QString &name);
126 void ItemCreatorDeActivated();
129 void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
130 void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
135 QList<ModelNode> adjustStatesForModelNodes(const QList<ModelNode> &nodeList) const;
136 void updateGraphicsIndicators();
137 void setSelectOnlyContentItemsAction(bool selectOnlyContentItems);
138 bool isMoveToolAvailable() const;
141 void setupFormEditorItemTree(const QmlItemNode &qmlItemNode);
145 QWeakPointer<FormEditorWidget> m_formEditorWidget;
146 QWeakPointer<FormEditorScene> m_scene;
147 MoveTool *m_moveTool;
148 SelectionTool *m_selectionTool;
149 ResizeTool *m_resizeTool;
150 AnchorTool *m_anchorTool;
151 DragTool *m_dragTool;
152 ItemCreatorTool *m_itemCreatorTool;
153 AbstractFormEditorTool *m_currentTool;
154 int m_transactionCounter;
159 #endif //FORMEDITORVIEW_H