diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 1766774d81afe084784af4b1e987cf6b16908c2e..30bcf48c098cf179903025f25c056a7a08872598 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -165,7 +165,6 @@ NavigationWidget::NavigationWidget(QAction *toggleSideBarAction) : { d->m_factoryModel->setSortRole(FactoryPriorityRole); setOrientation(Qt::Vertical); - insertSubItem(0, -1); // we don't have any entry to show yet d->m_instance = this; } @@ -327,17 +326,22 @@ void NavigationWidget::restoreSettings(QSettings *settings) settings->setValue("Navigation/Version", 2); } - for (int i=0; i<viewIds.count(); ++i) { - const QString &view = viewIds.at(i); - int index = factoryIndex(view); - - if (i >= d->m_subWidgets.size()) { - insertSubItem(i, index); + int position = 0; + foreach (const QString &id, viewIds) { + int index = factoryIndex(id); + if (index >= 0) { + // Only add if the id was actually found! + insertSubItem(position, index); + ++position; } else { - d->m_subWidgets.at(i)->setFactoryIndex(index); + restoreSplitterState = false; } } + if (d->m_subWidgets.isEmpty()) + // Make sure we have at least the projects widget + insertSubItem(0, qMax(0, factoryIndex(QLatin1String("Projects")))); + if (settings->contains("Navigation/Visible")) { setShown(settings->value("Navigation/Visible").toBool()); } else {