Skip to content

Commit 9dabbdc

Browse files
author
Robert Loehning
committed
TextEditor: Show new zoom factor when resetting
...mainly to not show the old zoom factor anymore. Change-Id: I01c3050ff38b0b328774e6d05bcc2fe913ee4f56 Reviewed-by: Eike Ziller <[email protected]>
1 parent 82693c8 commit 9dabbdc

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/plugins/texteditor/texteditorsettings.cpp

+12-5
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,16 @@ Core::Id TextEditorSettings::languageId(const QString &mimeType)
509509
return d->m_mimeTypeToLanguage.value(mimeType);
510510
}
511511

512+
void showZoomIndicator(QWidget *editor, const int newZoom)
513+
{
514+
if (editor) {
515+
Utils::FadingIndicator::showText(editor,
516+
QCoreApplication::translate("TextEditor::TextEditorSettings",
517+
"Zoom: %1%").arg(newZoom),
518+
Utils::FadingIndicator::SmallText);
519+
}
520+
}
521+
512522
void TextEditorSettings::fontZoomRequested(int zoom)
513523
{
514524
FontSettings &fs = const_cast<FontSettings&>(d->m_fontSettingsPage->fontSettings());
@@ -517,17 +527,14 @@ void TextEditorSettings::fontZoomRequested(int zoom)
517527
if (newZoom == previousZoom)
518528
return;
519529
fs.setFontZoom(newZoom);
520-
if (QWidget *editor = qobject_cast<QWidget *>(sender())) {
521-
Utils::FadingIndicator::showText(editor,
522-
tr("Zoom: %1%").arg(newZoom),
523-
Utils::FadingIndicator::SmallText);
524-
}
530+
showZoomIndicator(qobject_cast<QWidget *>(sender()), newZoom);
525531
d->m_fontSettingsPage->saveSettings();
526532
}
527533

528534
void TextEditorSettings::zoomResetRequested()
529535
{
530536
FontSettings &fs = const_cast<FontSettings&>(d->m_fontSettingsPage->fontSettings());
531537
fs.setFontZoom(100);
538+
showZoomIndicator(qobject_cast<QWidget *>(sender()), 100);
532539
d->m_fontSettingsPage->saveSettings();
533540
}

0 commit comments

Comments
 (0)