aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/welcome
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2021-02-15 15:53:38 +0100
committerEike Ziller <eike.ziller@qt.io>2021-02-16 16:09:40 +0000
commit502508d87d5ea57ff299dfc90669f39d323674d0 (patch)
tree31b9f7f46c33cad4ec677385f32032dcfa49cdf0 /src/plugins/welcome
parenta513f25c39df21930e823100563553db2a2b65a9 (diff)
Welcome: Do not save default value to settings
Task-number: QTCREATORBUG-24762 Change-Id: I9a587c76dfabee1cd707e6861de5bbc0e3e7583e Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/welcome')
-rw-r--r--src/plugins/welcome/welcomeplugin.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp
index 875cfb7c80f..1f665427103 100644
--- a/src/plugins/welcome/welcomeplugin.cpp
+++ b/src/plugins/welcome/welcomeplugin.cpp
@@ -121,6 +121,7 @@ private:
QList<IWelcomePage *> m_pluginList;
QList<WelcomePageButton *> m_pageButtons;
Id m_activePage;
+ Id m_defaultPage;
};
class WelcomePlugin final : public ExtensionSystem::IPlugin
@@ -358,8 +359,10 @@ WelcomeMode::WelcomeMode()
WelcomeMode::~WelcomeMode()
{
- QSettings *settings = ICore::settings();
- settings->setValue(currentPageSettingsKeyC, m_activePage.toSetting());
+ QtcSettings *settings = ICore::settings();
+ settings->setValueWithDefault(currentPageSettingsKeyC,
+ m_activePage.toSetting(),
+ m_defaultPage.toSetting());
delete m_modeWidget;
}
@@ -371,13 +374,14 @@ void WelcomeMode::initPlugins()
for (IWelcomePage *page : IWelcomePage::allWelcomePages())
addPage(page);
- if (!m_activePage.isValid() && !m_pageButtons.isEmpty()) {
+ if (!m_pageButtons.isEmpty()) {
const int welcomeIndex = Utils::indexOf(m_pluginList,
Utils::equal(&IWelcomePage::id,
Utils::Id("Examples")));
const int defaultIndex = welcomeIndex >= 0 ? welcomeIndex : 0;
- m_activePage = m_pluginList.at(defaultIndex)->id();
- m_pageButtons.at(defaultIndex)->click();
+ m_defaultPage = m_pluginList.at(defaultIndex)->id();
+ if (!m_activePage.isValid())
+ m_pageButtons.at(defaultIndex)->click();
}
}