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);
|
||||
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);
|
||||
|
Reference in New Issue
Block a user