NavigationWidget: Use find() instead of contains() + value()

In this way we lookup just once.

Change-Id: I8eb9e98980acc3f3b7f6734b04dd4c6b06ec40e1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2024-01-15 20:15:35 +01:00
parent bd21612816
commit 604ccf4e23

View File

@@ -210,11 +210,9 @@ QWidget *NavigationWidget::activateSubWidget(Id factoryId, Side fallbackSide)
NavigationWidget *navigationWidget = instance(fallbackSide); NavigationWidget *navigationWidget = instance(fallbackSide);
int preferredPosition = -1; int preferredPosition = -1;
// TODO: Use find if (const auto it = s_activationsMap.constFind(factoryId); it != s_activationsMap.constEnd()) {
if (s_activationsMap.contains(factoryId)) { navigationWidget = instance(it->side);
const ActivationInfo info = s_activationsMap.value(factoryId); preferredPosition = it->position;
navigationWidget = instance(info.side);
preferredPosition = info.position;
} }
return navigationWidget->activateSubWidget(factoryId, preferredPosition); return navigationWidget->activateSubWidget(factoryId, preferredPosition);