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 info@qt.nokia.com.
31 **************************************************************************/
33 #ifndef FORMEDITORVIEW_H
34 #define FORMEDITORVIEW_H
36 #include <qmlmodelview.h>
40 class QGraphicsSceneMouseEvent;
43 namespace QmlDesigner {
45 class FormEditorWidget;
46 class FormEditorNodeInstanceView;
47 class FormEditorScene;
48 class NodeInstanceView;
50 class AbstractFormEditorTool;
56 class ItemLibraryEntry;
59 class FormEditorView : public QmlModelView
64 FormEditorView(QObject *parent);
68 void modelAttached(Model *model);
69 void modelAboutToBeDetached(Model *model);
71 void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports);
73 void nodeCreated(const ModelNode &createdNode);
74 void nodeAboutToBeRemoved(const ModelNode &removedNode);
75 void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
76 void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId);
77 void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList);
78 void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
79 void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
80 void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
82 void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
83 const QList<ModelNode> &lastSelectedNodeList);
84 void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
85 void propertiesRemoved(const QList<AbstractProperty> &propertyList);
88 FormEditorWidget *widget() const;
89 AbstractFormEditorTool *currentTool() const;
90 FormEditorScene *scene() const;
92 bool changeToMoveTool();
93 bool changeToMoveTool(const QPointF &beginPoint);
94 void changeToDragTool();
95 void changeToSelectionTool();
96 void changeToSelectionTool(QGraphicsSceneMouseEvent *event);
97 void changeToResizeTool();
98 void changeToAnchorTool();
99 void changeToTransformTools();
101 void nodeSlidedToIndex(const NodeListProperty &listProperty, int newIndex, int oldIndex);
102 void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
104 void instancesCompleted(const QVector<ModelNode> &completedNodeList);
105 void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
106 void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
107 void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
108 void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
109 void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
110 void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
112 void rewriterBeginTransaction();
113 void rewriterEndTransaction();
115 double margins() const;
116 double spacing() const;
117 void deActivateItemCreator();
119 void actualStateChanged(const ModelNode &node);
126 QList<ModelNode> adjustStatesForModelNodes(const QList<ModelNode> &nodeList) const;
127 void updateGraphicsIndicators();
128 void setSelectOnlyContentItemsAction(bool selectOnlyContentItems);
129 bool isMoveToolAvailable() const;
132 void setupFormEditorItemTree(const QmlItemNode &qmlItemNode);
133 void removeNodeFromScene(const QmlItemNode &qmlItemNode);
134 void hideNodeFromScene(const QmlItemNode &qmlItemNode);
137 QWeakPointer<FormEditorWidget> m_formEditorWidget;
138 QWeakPointer<FormEditorScene> m_scene;
139 MoveTool *m_moveTool;
140 SelectionTool *m_selectionTool;
141 ResizeTool *m_resizeTool;
142 AnchorTool *m_anchorTool;
143 DragTool *m_dragTool;
144 AbstractFormEditorTool *m_currentTool;
145 int m_transactionCounter;
150 #endif //FORMEDITORVIEW_H