Commit b8494fa6 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: fix for states

stateChanged() was never called.

cleanup:
I removed stateChanged() and use actualStateChanged()

Change-Id: I11a73b21dca5083147223f6e4f23da4c7305263c
Reviewed-on: http://codereview.qt.nokia.com/1677


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@nokia.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent abc60352
......@@ -651,9 +651,11 @@ bool FormEditorView::isMoveToolAvailable() const
return true;
}
void FormEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState)
void FormEditorView::actualStateChanged(const ModelNode &node)
{
QmlModelView::stateChanged(newQmlModelState, oldQmlModelState);
QmlModelView::actualStateChanged(node);
QmlModelState newQmlModelState(node);
m_formEditorWidget->anchorToolAction()->setEnabled(newQmlModelState.isBaseState());
......
......@@ -118,6 +118,8 @@ public:
double spacing() const;
void deActivateItemCreator();
void actualStateChanged(const ModelNode &node);
public slots:
void activateItemCreator(const QString &name);
......@@ -125,7 +127,6 @@ signals:
void ItemCreatorDeActivated();
protected:
void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
void reset();
protected slots:
......
......@@ -933,9 +933,11 @@ QWidget *PropertyEditor::widget()
return m_stackedWidget;
}
void PropertyEditor::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState)
void PropertyEditor::actualStateChanged(const ModelNode &node)
{
QmlModelView::stateChanged(newQmlModelState, oldQmlModelState);
QmlModelView::actualStateChanged(node);
QmlModelState newQmlModelState(node);
Q_ASSERT(newQmlModelState.isValid());
if (debug)
qDebug() << Q_FUNC_INFO << newQmlModelState.name();
......
......@@ -111,12 +111,12 @@ public:
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void resetView();
void actualStateChanged(const ModelNode &node);
protected:
void timerEvent(QTimerEvent *event);
void otherPropertyChanged(const QmlObjectNode &, const QString &propertyName);
void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
void setupPane(const QString &typeName);
void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value);
......
......@@ -308,14 +308,16 @@ void StatesEditorView::nodeInstancePropertyChanged(const ModelNode &node, const
QmlModelView::nodeInstancePropertyChanged(node, propertyName);
}
void StatesEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState)
void StatesEditorView::actualStateChanged(const ModelNode &node)
{
QmlModelState newQmlModelState(node);
if (newQmlModelState.isBaseState()) {
m_statesEditorWidget->setCurrentStateInternalId(0);
} else {
m_statesEditorWidget->setCurrentStateInternalId(newQmlModelState.modelNode().internalId());
}
QmlModelView::stateChanged(newQmlModelState, oldQmlModelState);
QmlModelView::actualStateChanged(node);
}
void StatesEditorView::transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName)
......
......@@ -67,7 +67,7 @@ public:
// QmlModelView
void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
void actualStateChanged(const ModelNode &node);
void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
void parentChanged(const QmlObjectNode &qmlObjectNode);
void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
......
......@@ -131,7 +131,6 @@ protected:
virtual void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName) ;
virtual void parentChanged(const QmlObjectNode &qmlObjectNode);
virtual void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName);
virtual void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState);
void activateState(const QmlModelState &state);
......
......@@ -440,16 +440,8 @@ void QmlModelView::rewriterEndTransaction()
}
void QmlModelView::actualStateChanged(const ModelNode &node)
void QmlModelView::actualStateChanged(const ModelNode & /*node*/)
{
QmlModelState newState(node);
QmlModelState oldState = currentState();
if (!newState.isValid())
newState = baseState();
if (newState != oldState)
stateChanged(newState, oldState);
}
......@@ -480,8 +472,5 @@ void QmlModelView::otherPropertyChanged(const QmlObjectNode &/*qmlObjectNode*/,
{
}
void QmlModelView::stateChanged(const QmlModelState &/*newQmlModelState*/, const QmlModelState &/*oldQmlModelState*/)
{
}
} //QmlDesigner
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment