From 2165bd4d8349496411895b7fbf58ab0ddf300e8d Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@nokia.com> Date: Thu, 6 May 2010 14:04:24 +0200 Subject: [PATCH] QuickDesigner: Add debugging output to track State Switching Of course disabled by default --- .../stateseditor/stateseditorview.cpp | 3 +++ .../designercore/model/qmlmodelview.cpp | 24 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index 70f285ed444..0c76cd254fe 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -461,6 +461,9 @@ void StatesEditorView::sceneChanged() } void StatesEditorView::startUpdateTimer(int i, int offset) { + if (debug) + qDebug() << __FUNCTION__ << i << offset; + if (i < 0 || i > m_modelStates.count()) return; diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp index 174ea7282fe..ae081e94d41 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp @@ -39,6 +39,10 @@ #include <QDebug> #include <QMessageBox> +enum { + debug = false +}; + namespace QmlDesigner { QmlModelView::QmlModelView(QObject *parent) @@ -235,12 +239,16 @@ QmlObjectNode QmlModelView::fxObjectNodeForId(const QString &id) void QmlModelView::customNotification(const AbstractView * /* view */, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> & /* data */) { + if (debug) + qDebug() << this << __FUNCTION__ << identifier << nodeList; + if (identifier == "__state changed__") { QmlModelState state(nodeList.first()); - if (state.isValid()) + if (state.isValid()) { activateState(state); - else + } else { activateState(baseState()); + } } } @@ -289,6 +297,8 @@ static bool isTransformProperty(const QString &name) void QmlModelView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName) { + if (debug) + qDebug() << this << __FUNCTION__ << node << propertyName; QmlObjectNode qmlObjectNode(node); @@ -307,6 +317,9 @@ void QmlModelView::nodeInstancePropertyChanged(const ModelNode &node, const QStr void QmlModelView::activateState(const QmlModelState &state) { + if (debug) + qDebug() << this << __FUNCTION__ << state; + if (!state.isValid()) return; @@ -326,6 +339,9 @@ void QmlModelView::activateState(const QmlModelState &state) void QmlModelView::changeToState(const ModelNode &node, const QString &stateName) { + if (debug) + qDebug() << this << __FUNCTION__ << node << stateName; + QmlItemNode itemNode(node); QmlModelState newState; @@ -355,8 +371,10 @@ void QmlModelView::otherPropertyChanged(const QmlObjectNode &/*qmlObjectNode*/, { } -void QmlModelView::stateChanged(const QmlModelState &/*newQmlModelState*/, const QmlModelState &/*oldQmlModelState*/) +void QmlModelView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState) { + if (debug) + qDebug() << this << __FUNCTION__ << oldQmlModelState << "to" << newQmlModelState; } } //QmlDesigner -- GitLab