From bf422ad41996db86a4f90b6d174d79b3d7c03cd3 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 3 Feb 2022 07:45:59 +0800 Subject: [PATCH] - fix: editor's font size set by ctrl+mouse wheel will be reset by open the option dialog --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 2 ++ RedPandaIDE/settingsdialog/environmentappearencewidget.cpp | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 69833f7e..4b09f44d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,7 @@ Red Panda C++ Version 0.14.1 - enhancement: new contrast theme, contributed by Alan-CRL - enhancement: theme now have default icon set - fix: wrong icons for file associations + - fix: editor's font size set by ctrl+mouse wheel will be reset by open the option dialog Red Panda C++ Version 0.14.0 - enhancement: custom icon set ( in the configuration folder) diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 1cc7ebf8..74934e2a 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -505,12 +505,14 @@ void Editor::wheelEvent(QWheelEvent *event) { if (event->angleDelta().y()>0) { size = std::min(99,size+1); pSettings->editor().setFontSize(size); + pSettings->editor().save(); pMainWindow->updateEditorSettings(); event->accept(); return; } else if (event->angleDelta().y()<0) { size = std::max(2,size-1); pSettings->editor().setFontSize(size); + pSettings->editor().save(); pMainWindow->updateEditorSettings(); event->accept(); return; diff --git a/RedPandaIDE/settingsdialog/environmentappearencewidget.cpp b/RedPandaIDE/settingsdialog/environmentappearencewidget.cpp index 9ec2fff3..542118a3 100644 --- a/RedPandaIDE/settingsdialog/environmentappearencewidget.cpp +++ b/RedPandaIDE/settingsdialog/environmentappearencewidget.cpp @@ -70,6 +70,7 @@ void EnvironmentAppearenceWidget::doSave() PAppTheme appTheme = themeManager.theme(ui->cbTheme->currentData().toString()); if (appTheme && !appTheme->defaultColorScheme().isEmpty()) { pSettings->editor().setColorScheme(appTheme->defaultColorScheme()); + pSettings->editor().save(); pMainWindow->updateEditorColorSchemes(); } } @@ -81,7 +82,7 @@ void EnvironmentAppearenceWidget::doSave() pSettings->environment().setUseCustomIconSet(ui->chkUseCustomIconSet->isChecked()); pSettings->environment().setUseCustomTheme(ui->chkUseCustomTheme->isChecked()); - pSettings->editor().save(); + pSettings->environment().save(); pMainWindow->applySettings(); }