forked from qt-creator/qt-creator
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:
@@ -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);
|
||||||
|
Reference in New Issue
Block a user