Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [fontcolorwidget] Fix font selection and display issues #1009

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/plugins/codeeditor/gui/settings/fontcolorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void FontColorWidgetPrivate::initUI()
QLabel *infoLabel = new QLabel(FontColorWidget::tr("Font"), q);
fontComboBox = new DFontComboBox(q);
fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts);
fontComboBox->setEditable(false);

fontSizeComboBox = new QComboBox(q);
fontSizeComboBox->setMinimumWidth(100);
Expand Down Expand Up @@ -99,7 +100,7 @@ QWidget *FontColorWidgetPrivate::createItem(const QString &name, QWidget *widget
QList<int> FontColorWidgetPrivate::pointSizesForSelectedFont() const
{
QFontDatabase db;
const QString familyName = fontComboBox->currentFont().family();
const QString familyName = fontComboBox->currentText();
QList<int> sizeLst = db.pointSizes(familyName);
if (!sizeLst.isEmpty())
return sizeLst;
Expand Down Expand Up @@ -167,14 +168,14 @@ void FontColorWidget::setUserConfig(const QMap<QString, QVariant> &map)
void FontColorWidget::getUserConfig(QMap<QString, QVariant> &map)
{
QVariantMap fontMap;
fontMap.insert(Key::FontFamily, d->fontComboBox->currentFont().family());
fontMap.insert(Key::FontFamily, d->fontComboBox->currentText());
fontMap.insert(Key::FontSize, d->fontSizeComboBox->currentText().toInt());
fontMap.insert(Key::FontZoom, d->zoomSpinBox->value());

map.insert(Group::FontGroup, fontMap);

EditorSettings::instance()->setValue(Node::FontColor, Group::FontGroup, Key::FontFamily,
d->fontComboBox->currentFont().family());
d->fontComboBox->currentText());
EditorSettings::instance()->setValue(Node::FontColor, Group::FontGroup, Key::FontSize, d->fontSize);
EditorSettings::instance()->setValue(Node::FontColor, Group::FontGroup, Key::FontZoom, d->zoomSpinBox->value());
}
Expand Down
Loading