From c3c98cca785d24c05e552ed5ed113a7b73341965 Mon Sep 17 00:00:00 2001 From: mae <qt-info@nokia.com> Date: Thu, 18 Jun 2009 16:12:24 +0200 Subject: [PATCH] make zoom-in store the new size permanently in the settings. --- src/plugins/texteditor/fontsettingspage.cpp | 13 ++++++++----- src/plugins/texteditor/fontsettingspage.h | 2 ++ src/plugins/texteditor/texteditorsettings.cpp | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 93cd8525bb1..d61e91f7468 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -458,14 +458,17 @@ void FontSettingsPage::apply() const int size = d_ptr->ui.sizeComboBox->currentText().toInt(&ok); if (ok) d_ptr->m_value.setFontSize(size); + saveSettings(); +} - +void FontSettingsPage::saveSettings() +{ if (d_ptr->m_value != d_ptr->m_lastValue) { - d_ptr->m_lastValue = d_ptr->m_value; - if (QSettings *settings = Core::ICore::instance()->settings()) - d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, d_ptr->m_descriptions, settings); + d_ptr->m_lastValue = d_ptr->m_value; + if (QSettings *settings = Core::ICore::instance()->settings()) + d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, d_ptr->m_descriptions, settings); - QTimer::singleShot(0, this, SLOT(delayedChange())); + QTimer::singleShot(0, this, SLOT(delayedChange())); } } diff --git a/src/plugins/texteditor/fontsettingspage.h b/src/plugins/texteditor/fontsettingspage.h index 3d185d0756a..21fbbb7d251 100644 --- a/src/plugins/texteditor/fontsettingspage.h +++ b/src/plugins/texteditor/fontsettingspage.h @@ -96,6 +96,8 @@ public: void apply(); void finish(); + void saveSettings(); + const FontSettings &fontSettings() const; signals: diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index d843128a1d6..43099ac88be 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -175,7 +175,7 @@ void TextEditorSettings::fontSizeRequested(int pointSize) { FontSettings &fs = const_cast<FontSettings&>(m_fontSettingsPage->fontSettings()); fs.setFontSize(pointSize); - emit fontSettingsChanged(m_fontSettingsPage->fontSettings()); + m_fontSettingsPage->saveSettings(); } FontSettings TextEditorSettings::fontSettings() const -- GitLab