Commit 964dd4a3 authored by Eike Ziller's avatar Eike Ziller

Add a way to redirect the "install settings"

If the default install settings contain a value for
"Settings/InstallSettings", then that is used as the actual path for the
actual install settings instead.

If the path is relative, it is interpreted as relative to Qt Creator's

Change-Id: I212037112e88c60c94239580841aa1400d96fb73
Reviewed-by: default avatarhjk <>
Reviewed-by: Kai Koehne's avatarKai Koehne <>
parent 02d2b36c
......@@ -220,6 +220,25 @@ static inline QStringList getPluginPaths()
return rc;
static void setupInstallSettings()
// Check if the default install settings contain a setting for the actual install settings.
// This can be an absolute path, or a path relative to applicationDirPath().
// The result is interpreted like -settingspath, but for SystemScope
static const char kInstallSettingsKey[] = "Settings/InstallSettings";
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope,
QCoreApplication::applicationDirPath() + '/' + RELATIVE_DATA_PATH);
QSettings installSettings(QSettings::IniFormat, QSettings::UserScope,
if (installSettings.contains(kInstallSettingsKey)) {
QString installSettingsPath = installSettings.value(kInstallSettingsKey).toString();
if (QDir::isRelativePath(installSettingsPath))
installSettingsPath = QCoreApplication::applicationDirPath() + '/' + installSettingsPath;
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, installSettingsPath);
static QSettings *createUserSettings()
return new QSettings(QSettings::IniFormat, QSettings::UserScope,
......@@ -363,9 +382,8 @@ int main(int argc, char **argv)
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settingsPath);
// Must be done before any QSettings class is created
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope,
QCoreApplication::applicationDirPath() + '/' + RELATIVE_DATA_PATH);
// plugin manager takes control of this settings object
QSettings *settings = userSettings();
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment