summaryrefslogtreecommitdiff
path: root/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@nokia.com>2010-12-08 16:46:25 +0100
committerMarco Bubke <marco.bubke@nokia.com>2010-12-08 17:28:50 +0100
commit562d0c5fbd5a6581a9efe539047d1b8651d421c8 (patch)
tree2c6dd7fb2cfa1dd642fa082025b16864e118f5c2 /src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
parentfabf76d202984d1bd93d7e4d82d4a90de27743d0 (diff)
downloadqt-creator-562d0c5fbd5a6581a9efe539047d1b8651d421c8.tar.gz
QmlDesigner: Refactor states editor
Reviewed-By: Thomas Hartmann
Diffstat (limited to 'src/plugins/qmldesigner/components/stateseditor/stateseditorview.h')
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditorview.h42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
index cae5e5cbc9..c149c33cea 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
@@ -34,24 +34,18 @@
namespace QmlDesigner {
-namespace Internal {
class StatesEditorModel;
+class StatesEditorWidget;
class StatesEditorView : public QmlModelView {
Q_OBJECT
public:
- explicit StatesEditorView(StatesEditorModel *model, QObject *parent = 0);
+ explicit StatesEditorView(QObject *parent = 0);
- void setCurrentState(int index);
- void createState(const QString &name);
- void removeState(int index);
- void renameState(int index,const QString &newName);
- void duplicateCurrentState(int index);
-
- QmlItemNode stateRootNode() { return m_stateRootNode; }
- bool isAttachedToModel() const { return m_attachedToModel; }
+ void renameState(int nodeId,const QString &newName);
+ bool validStateName(const QString &name) const;
void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
@@ -62,9 +56,12 @@ public:
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
void nodeAboutToBeRemoved(const ModelNode &removedNode);
+ void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
+ void nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
+
// QmlModelView
void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
@@ -77,23 +74,24 @@ public:
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList, PropertyChangeFlags propertyChange);
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
-private:
- void insertModelState(int i, const QmlModelState &state);
- void removeModelState(const QmlModelState &state);
- void clearModelStates();
- int modelStateIndex(const QmlModelState &state);
+ StatesEditorWidget *widget();
+public slots:
+ void synchonizeCurrentStateFromWidget();
+ void createNewState();
+ void removeState(int nodeId);
- QList<QmlModelState> m_modelStates;
- StatesEditorModel *m_editorModel;
- QmlItemNode m_stateRootNode;
+private:
+ void resetModel();
+ void addState();
+ void duplicateCurrentState();
- QmlModelState m_oldRewriterAmendState;
- bool m_attachedToModel;
- bool m_settingSilentState;
+private:
+ QWeakPointer<StatesEditorModel> m_statesEditorModel;
+ QWeakPointer<StatesEditorWidget> m_statesEditorWidget;
+ int m_lastIndex;
};
-} // namespace Internal
} // namespace QmlDesigner
#endif // STATESEDITORVIEW_H