diff options
author | Robert Loehning <robert.loehning@theqtcompany.com> | 2016-01-27 17:44:54 +0100 |
---|---|---|
committer | Robert Loehning <robert.loehning@theqtcompany.com> | 2016-01-28 10:54:50 +0000 |
commit | 9dabbdceb77fc1194eadf3eff7936bbfda795c4c (patch) | |
tree | 0f87fada9aec8efe48363c113978616530ac06ac | |
parent | 82693c8abbafbd978873d2a7516054c62e1801ed (diff) | |
download | qt-creator-9dabbdceb77fc1194eadf3eff7936bbfda795c4c.tar.gz |
TextEditor: Show new zoom factor when resetting
...mainly to not show the old zoom factor anymore.
Change-Id: I01c3050ff38b0b328774e6d05bcc2fe913ee4f56
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r-- | src/plugins/texteditor/texteditorsettings.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 689842add0..30ab4f13ba 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -509,6 +509,16 @@ Core::Id TextEditorSettings::languageId(const QString &mimeType) return d->m_mimeTypeToLanguage.value(mimeType); } +void showZoomIndicator(QWidget *editor, const int newZoom) +{ + if (editor) { + Utils::FadingIndicator::showText(editor, + QCoreApplication::translate("TextEditor::TextEditorSettings", + "Zoom: %1%").arg(newZoom), + Utils::FadingIndicator::SmallText); + } +} + void TextEditorSettings::fontZoomRequested(int zoom) { FontSettings &fs = const_cast<FontSettings&>(d->m_fontSettingsPage->fontSettings()); @@ -517,11 +527,7 @@ void TextEditorSettings::fontZoomRequested(int zoom) if (newZoom == previousZoom) return; fs.setFontZoom(newZoom); - if (QWidget *editor = qobject_cast<QWidget *>(sender())) { - Utils::FadingIndicator::showText(editor, - tr("Zoom: %1%").arg(newZoom), - Utils::FadingIndicator::SmallText); - } + showZoomIndicator(qobject_cast<QWidget *>(sender()), newZoom); d->m_fontSettingsPage->saveSettings(); } @@ -529,5 +535,6 @@ void TextEditorSettings::zoomResetRequested() { FontSettings &fs = const_cast<FontSettings&>(d->m_fontSettingsPage->fontSettings()); fs.setFontZoom(100); + showZoomIndicator(qobject_cast<QWidget *>(sender()), 100); d->m_fontSettingsPage->saveSettings(); } |