diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-01-21 09:55:50 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-01-21 23:26:22 +0000 |
commit | d39a0fbf263e5963b73945247d52ecde3b49112f (patch) | |
tree | 8cd0dda66d3c02741b0d3cb0b068bc01ca179f7e | |
parent | 4099a51dd5a9564e580a0f3676a0a850bd4ec26d (diff) |
Use qt.qml.states logging category instead of STATECHANGE_DEBUG env
- It should not be a warning: it's for debugging.
- It's nice to have the logging category instead of "default" in case
you have %{category} in your QT_MESSAGE_PATTERN.
- The env var didn't even have QT or QML in it.
[ChangeLog][QtQml] The new qt.qml.states logging category is useful
for debugging states and transitions. It replaces the STATECHANGE_DEBUG
environment variable.
Task-number: QTBUG-100117
Change-Id: If67e21488a66867645f3a395941fcc92d3ea7bbb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 3fc68053db3acd9f7bef23d3aef1f7ac874e73dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/quick/util/qquickstate.cpp | 15 | ||||
-rw-r--r-- | src/quick/util/qquickstategroup.cpp | 13 | ||||
-rw-r--r-- | src/quick/util/qquicktransitionmanager.cpp | 15 |
3 files changed, 19 insertions, 24 deletions
diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp index bd563e34b8..735b5267f7 100644 --- a/src/quick/util/qquickstate.cpp +++ b/src/quick/util/qquickstate.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE -DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); +Q_LOGGING_CATEGORY(lcStates, "qt.qml.states") QQuickStateAction::QQuickStateAction() : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(nullptr), event(nullptr), @@ -671,19 +671,16 @@ void QQuickState::apply(QQuickTransition *trans, QQuickState *revert) // All the local reverts now become part of the ongoing revertList d->revertList << additionalReverts; -#ifndef QT_NO_DEBUG_STREAM - // Output for debugging - if (stateChangeDebug()) { + if (lcStates().isDebugEnabled()) { for (const QQuickStateAction &action : qAsConst(applyList)) { if (action.event) - qWarning() << " QQuickStateAction event:" << action.event->type(); + qCDebug(lcStates) << "QQuickStateAction event:" << action.event->type(); else - qWarning() << " QQuickStateAction:" << action.property.object() - << action.property.name() << "From:" << action.fromValue - << "To:" << action.toValue; + qCDebug(lcStates) << "QQuickStateAction on" << action.property.object() + << action.property.name() << "from:" << action.fromValue + << "to:" << action.toValue; } } -#endif d->transitionManager.transition(applyList, trans); } diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp index b86333943c..d664b67485 100644 --- a/src/quick/util/qquickstategroup.cpp +++ b/src/quick/util/qquickstategroup.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); +Q_DECLARE_LOGGING_CATEGORY(lcStates) class QQuickStateGroupPrivate : public QObjectPrivate { @@ -377,8 +377,7 @@ bool QQuickStateGroupPrivate::updateAutoState() if (state->isWhenKnown()) { if (state->isNamed()) { if (state->when()) { - if (stateChangeDebug()) - qWarning() << "Setting auto state due to expression"; + qCDebug(lcStates) << "Setting auto state due to expression"; if (currentState != state->name()) { q->setState(state->name()); return true; @@ -483,11 +482,11 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state, applyingState = true; QQuickTransition *transition = ignoreTrans ? nullptr : findTransition(currentState, state); - if (stateChangeDebug()) { - qWarning() << this << "Changing state. From" << currentState << ". To" << state; + if (lcStates().isDebugEnabled()) { + qCDebug(lcStates) << this << "changing state from:" << currentState << "to:" << state; if (transition) - qWarning() << " using transition" << transition->fromState() - << transition->toState(); + qCDebug(lcStates) << " using transition" << transition->fromState() + << transition->toState(); } QQuickState *oldState = nullptr; diff --git a/src/quick/util/qquicktransitionmanager.cpp b/src/quick/util/qquicktransitionmanager.cpp index 97c1fcd045..6784ad83d6 100644 --- a/src/quick/util/qquicktransitionmanager.cpp +++ b/src/quick/util/qquicktransitionmanager.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE -DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); +Q_DECLARE_LOGGING_CATEGORY(lcStates) class QQuickTransitionManagerPrivate { @@ -240,18 +240,17 @@ void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list, action.property.write(action.toValue); } } -#ifndef QT_NO_DEBUG_STREAM - if (stateChangeDebug()) { + if (lcStates().isDebugEnabled()) { for (const QQuickStateAction &action : qAsConst(applyList)) { if (action.event) - qWarning() << " No transition for event:" << action.event->type(); + qCDebug(lcStates) << "no transition for event:" << action.event->type(); else - qWarning() << " No transition for:" << action.property.object() - << action.property.name() << "From:" << action.fromValue - << "To:" << action.toValue; + qCDebug(lcStates) << "no transition for:" << action.property.object() + << action.property.name() << "from:" << action.fromValue + << "to:" << action.toValue; } } -#endif + if (!transition) complete(); } |