From 42536411efc79760bbf142088cfe142eb0bf8170 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 23 Jul 2024 09:48:37 +0200 Subject: [PATCH] Improve debugging of context changes Add some more information to the core logging category. Change-Id: Ie2b4a473cfb4b5f721860457282ee668d828cefa Reviewed-by: hjk --- src/plugins/coreplugin/icore.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index ff4f57e498a..711fa5c424c 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -1331,8 +1331,6 @@ static bool hideToolsMenu() return Core::ICore::settings()->value(Constants::SETTINGS_MENU_HIDE_TOOLS, false).toBool(); } -enum { debugMainWindow = 0 }; - namespace Internal { void ICorePrivate::init() @@ -2332,11 +2330,6 @@ void ICorePrivate::updateContextObject(const QList &context) emit m_core->contextAboutToChange(context); m_activeContext = context; updateContext(); - if (debugMainWindow) { - qDebug() << "new context objects =" << context; - for (const IContext *c : context) - qDebug() << (c ? c->widget() : nullptr) << (c ? c->widget()->metaObject()->className() : nullptr); - } } void ICorePrivate::readSettings() @@ -2417,8 +2410,17 @@ void ICorePrivate::updateContext() } if (coreLog().isDebugEnabled()) { - qCDebug(coreLog) << "context changed:" + qCDebug(coreLog) << "Context changed:"; + qCDebug(coreLog) << " " << Utils::transform>(uniquecontexts, &Id::toString); + qCDebug(coreLog) << " " + << Utils::transform>(m_activeContext, [](IContext *c) { + return QString("%1: %2").arg( + QString::fromUtf8(c->metaObject()->className()), + c->widget() + ? QString::fromUtf8(c->widget()->metaObject()->className()) + : QString("")); + }); } ActionManager::setContext(uniquecontexts); emit m_core->contextChanged(uniquecontexts);