diff options
author | Shawn Rutledge <[email protected]> | 2022-01-21 09:55:50 +0100 |
---|---|---|
committer | Shawn Rutledge <[email protected]> | 2022-01-21 15:29:56 +0000 |
commit | 3fc68053db3acd9f7bef23d3aef1f7ac874e73dc (patch) | |
tree | bd88dce3581bf41e2596072eb1dd170eb210db33 /src/quick/util | |
parent | 44ca135c5a4d02ab29b57a3f15b84850aafb1cec (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
Pick-to: 6.3
Change-Id: If67e21488a66867645f3a395941fcc92d3ea7bbb
Reviewed-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'src/quick/util')
-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(); } |