Commit 0cf82099 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

fixed a crash with sidebar when using old settings files

If the user uses old QtC settings files (QtCreator.ini), sidebar item
names are there translated. Because the new settings uses id's instead
of translated names, old sidebar items will not exist on save, causing
crashes. this fixes that issue.

Reviewed-by: con
parent a8133e08
......@@ -218,11 +218,19 @@ void SideBar::saveSettings(QSettings *settings, const QString &name)
const QString prefix = name.isEmpty() ? name : (name + QLatin1Char('/'));
QStringList views;
for (int i = 0; i < m_widgets.count(); ++i)
for (int i = 0; i < m_widgets.count(); ++i) {
QString currentItemId =>currentItemId();
if (!currentItemId.isEmpty())
if (views.isEmpty() && m_itemMap.size()) {
QMapIterator<QString, QWeakPointer<SideBarItem> > iter(m_itemMap);;
settings->setValue(prefix + "Views", views);
settings->setValue(prefix + "Visible", true);//isVisible());
settings->setValue(prefix + "Visible", true);
settings->setValue(prefix + "VerticalPosition", saveState());
settings->setValue(prefix + "Width", width());
......@@ -244,6 +252,7 @@ void SideBar::readSettings(QSettings *settings, const QString &name)
if (views.count()) {
foreach (const QString &id, views)
insertSideBarWidget(m_widgets.count(), id);
} else {
......@@ -365,7 +374,9 @@ QString SideBarWidget::currentItemTitle() const
QString SideBarWidget::currentItemId() const
return m_currentItem->id();
if (m_currentItem)
return m_currentItem->id();
return QString();
void SideBarWidget::setCurrentItem(const QString &id)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment