summaryrefslogtreecommitdiff
path: root/src/plugins/qmldesigner/settingspage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmldesigner/settingspage.cpp')
-rw-r--r--src/plugins/qmldesigner/settingspage.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/qmldesigner/settingspage.cpp b/src/plugins/qmldesigner/settingspage.cpp
index 700402680a..7c1530fedb 100644
--- a/src/plugins/qmldesigner/settingspage.cpp
+++ b/src/plugins/qmldesigner/settingspage.cpp
@@ -63,7 +63,7 @@ public:
void apply() final;
- DesignerSettings settings() const;
+ QHash<QByteArray, QVariant> newSettings() const;
void setSettings(const DesignerSettings &settings);
private:
@@ -108,9 +108,9 @@ SettingsPageWidget::SettingsPageWidget()
setSettings(QmlDesignerPlugin::instance()->settings());
}
-DesignerSettings SettingsPageWidget::settings() const
+QHash<QByteArray, QVariant> SettingsPageWidget::newSettings() const
{
- DesignerSettings settings = QmlDesignerPlugin::instance()->settings();
+ QHash<QByteArray, QVariant> settings;
settings.insert(DesignerSettingsKey::ITEMSPACING, m_ui.spinItemSpacing->value());
settings.insert(DesignerSettingsKey::CONTAINERPADDING, m_ui.spinSnapMargin->value());
settings.insert(DesignerSettingsKey::CANVASWIDTH, m_ui.spinCanvasWidth->value());
@@ -154,7 +154,8 @@ DesignerSettings SettingsPageWidget::settings() const
m_ui.fallbackPuppetPathLineEdit->lineEdit()->placeholderText());
if (newFallbackPuppetPath.isEmpty())
newFallbackPuppetPath = m_ui.fallbackPuppetPathLineEdit->lineEdit()->placeholderText();
- QString oldFallbackPuppetPath = PuppetCreator::qmlPuppetFallbackDirectory(settings);
+
+ QString oldFallbackPuppetPath = PuppetCreator::qmlPuppetFallbackDirectory(QmlDesignerPlugin::settings());
if (oldFallbackPuppetPath != newFallbackPuppetPath && QFileInfo::exists(newFallbackPuppetPath)) {
if (newFallbackPuppetPath == PuppetCreator::defaultPuppetFallbackDirectory())
@@ -270,8 +271,7 @@ void SettingsPageWidget::setSettings(const DesignerSettings &settings)
void SettingsPageWidget::apply()
{
- DesignerSettings currentSettings(QmlDesignerPlugin::instance()->settings());
- DesignerSettings newSettings = settings();
+ auto settings = newSettings();
const auto restartNecessaryKeys = {
DesignerSettingsKey::PUPPET_DEFAULT_DIRECTORY,
@@ -285,7 +285,7 @@ void SettingsPageWidget::apply()
};
for (const char * const key : restartNecessaryKeys) {
- if (currentSettings.value(key) != newSettings.value(key)) {
+ if (QmlDesignerPlugin::settings().value(key) != settings.value(key)) {
QMessageBox::information(Core::ICore::dialogParent(), tr("Restart Required"),
tr("The made changes will take effect after a "
"restart of the QML Emulation layer or %1.")
@@ -294,7 +294,7 @@ void SettingsPageWidget::apply()
}
}
- QmlDesignerPlugin::instance()->setSettings(newSettings);
+ QmlDesignerPlugin::settings().insert(settings);
}
SettingsPage::SettingsPage()