From 6c454143cbfae1453caa04cc3abd8568429b0a8a Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 20 Mar 2024 21:40:06 +0800 Subject: [PATCH] fix: font combo list display lots of blank lines after only show monospaced fonts. --- RedPandaIDE/settingsdialog/debuggeneralwidget.cpp | 1 + RedPandaIDE/settingsdialog/editorfontwidget.cpp | 1 + RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp | 1 + RedPandaIDE/widgets/editorfontdialog.cpp | 2 ++ 4 files changed, 5 insertions(+) diff --git a/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp b/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp index 038f8cba..ea607161 100644 --- a/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp @@ -98,4 +98,5 @@ void DebugGeneralWidget::on_chkOnlyMono_stateChanged(int) } else { ui->cbFont->setFontFilters(QFontComboBox::FontFilter::AllFonts); } + ui->cbFont->view()->reset(); } diff --git a/RedPandaIDE/settingsdialog/editorfontwidget.cpp b/RedPandaIDE/settingsdialog/editorfontwidget.cpp index 76eb8e8d..082fdaef 100644 --- a/RedPandaIDE/settingsdialog/editorfontwidget.cpp +++ b/RedPandaIDE/settingsdialog/editorfontwidget.cpp @@ -65,6 +65,7 @@ void EditorFontWidget::on_chkGutterOnlyMonospacedFonts_stateChanged(int) } else { ui->cbGutterFont->setFontFilters(QFontComboBox::FontFilter::AllFonts); } + ui->cbGutterFont->view()->reset(); } void EditorFontWidget::on_btnAddFont_clicked() diff --git a/RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp b/RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp index 02d9b2f4..0a445026 100644 --- a/RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp +++ b/RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp @@ -82,4 +82,5 @@ void ExecutorProblemSetWidget::on_chkOnlyMonospaced_stateChanged(int ) } else { ui->cbFont->setFontFilters(QFontComboBox::FontFilter::AllFonts); } + ui->cbFont->view()->reset(); } diff --git a/RedPandaIDE/widgets/editorfontdialog.cpp b/RedPandaIDE/widgets/editorfontdialog.cpp index 5563ae07..431ef326 100644 --- a/RedPandaIDE/widgets/editorfontdialog.cpp +++ b/RedPandaIDE/widgets/editorfontdialog.cpp @@ -1,5 +1,6 @@ #include "editorfontdialog.h" #include "ui_editorfontdialog.h" +#include EditorFontDialog::EditorFontDialog(QWidget *parent) : QDialog(parent) @@ -28,6 +29,7 @@ void EditorFontDialog::on_chkMonoOnly_toggled(bool checked) { QString savedFont = ui->fontComboBox->currentFont().family(); ui->fontComboBox->setFontFilters(checked ? QFontComboBox::MonospacedFonts : QFontComboBox::AllFonts); + ui->fontComboBox->view()->reset(); ui->fontComboBox->setCurrentFont(QFont(savedFont)); }