2024-03-17 11:18:09 +08:00
|
|
|
#include "editorfontdialog.h"
|
|
|
|
#include "ui_editorfontdialog.h"
|
2024-03-20 21:40:06 +08:00
|
|
|
#include <QAbstractItemView>
|
2024-03-17 11:18:09 +08:00
|
|
|
|
|
|
|
EditorFontDialog::EditorFontDialog(QWidget *parent)
|
|
|
|
: QDialog(parent)
|
|
|
|
, ui(new Ui::EditorFontDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorFontDialog::~EditorFontDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString EditorFontDialog::fontFamily() const
|
|
|
|
{
|
|
|
|
return mFontFamily;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorFontDialog::setFontFamily(const QString &fontFamily)
|
|
|
|
{
|
|
|
|
mFontFamily = fontFamily;
|
|
|
|
ui->fontComboBox->setCurrentFont(QFont(mFontFamily));
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorFontDialog::on_chkMonoOnly_toggled(bool checked)
|
|
|
|
{
|
|
|
|
QString savedFont = ui->fontComboBox->currentFont().family();
|
|
|
|
ui->fontComboBox->setFontFilters(checked ? QFontComboBox::MonospacedFonts : QFontComboBox::AllFonts);
|
2024-03-20 21:40:06 +08:00
|
|
|
ui->fontComboBox->view()->reset();
|
2024-03-17 11:18:09 +08:00
|
|
|
ui->fontComboBox->setCurrentFont(QFont(savedFont));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EditorFontDialog::on_buttonBox_accepted()
|
|
|
|
{
|
|
|
|
mFontFamily = ui->fontComboBox->currentFont().family();
|
|
|
|
}
|
|
|
|
|