From 604ccf4e23b226fac4aa08927b5b04a4bb5276ee Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 15 Jan 2024 20:15:35 +0100 Subject: [PATCH] NavigationWidget: Use find() instead of contains() + value() In this way we lookup just once. Change-Id: I8eb9e98980acc3f3b7f6734b04dd4c6b06ec40e1 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/navigationwidget.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 0c744d723df..9aec8e445f0 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -210,11 +210,9 @@ QWidget *NavigationWidget::activateSubWidget(Id factoryId, Side fallbackSide) NavigationWidget *navigationWidget = instance(fallbackSide); int preferredPosition = -1; - // TODO: Use find - if (s_activationsMap.contains(factoryId)) { - const ActivationInfo info = s_activationsMap.value(factoryId); - navigationWidget = instance(info.side); - preferredPosition = info.position; + if (const auto it = s_activationsMap.constFind(factoryId); it != s_activationsMap.constEnd()) { + navigationWidget = instance(it->side); + preferredPosition = it->position; } return navigationWidget->activateSubWidget(factoryId, preferredPosition);