fix: font combo list display lots of blank lines after only show monospaced fonts.

This commit is contained in:
Roy Qu 2024-03-20 21:40:06 +08:00
parent d054d9ffce
commit 6c454143cb
4 changed files with 5 additions and 0 deletions

View File

@ -98,4 +98,5 @@ void DebugGeneralWidget::on_chkOnlyMono_stateChanged(int)
} else {
ui->cbFont->setFontFilters(QFontComboBox::FontFilter::AllFonts);
}
ui->cbFont->view()->reset();
}

View File

@ -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()

View File

@ -82,4 +82,5 @@ void ExecutorProblemSetWidget::on_chkOnlyMonospaced_stateChanged(int )
} else {
ui->cbFont->setFontFilters(QFontComboBox::FontFilter::AllFonts);
}
ui->cbFont->view()->reset();
}

View File

@ -1,5 +1,6 @@
#include "editorfontdialog.h"
#include "ui_editorfontdialog.h"
#include <QAbstractItemView>
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));
}