Skip to content

Commit

Permalink
Don't rely on label font for saving font settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-fedin authored and detiam committed Oct 17, 2024
1 parent 5b652d2 commit eafd83f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/qt6ct/fontspage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ FontsPage::~FontsPage()
void FontsPage::writeSettings(QSettings *settings)
{
settings->beginGroup("Fonts");
settings->setValue("general", m_ui->generalFontLabel->font().toString());
settings->setValue("fixed", m_ui->fixedFontLabel->font().toString());
settings->setValue("general", m_ui->generalFontLabel->property("value"));
settings->setValue("fixed", m_ui->fixedFontLabel->property("value"));
settings->endGroup();
}

Expand All @@ -81,6 +81,7 @@ void FontsPage::onFontChangeRequested(QWidget *widget)
|| font.styleName() == QLatin1String("Roman")))
font.setStyleName(QString());

widget->setProperty("value", font.toString());
widget->setFont(font);
qobject_cast<QLabel*>(widget)->setText(font.family () + " " + QString::number(font.pointSize ()));
}
Expand All @@ -101,6 +102,7 @@ void FontsPage::loadFont(QSettings *settings, QLabel *label, const QString &key)
: QFontDatabase::systemFont(QFontDatabase::GeneralFont)).value<QFont>();
label->setText(font.family() + " " + QString::number(font.pointSize()));
label->setFont(font);
label->setProperty("value", font.toString());
}

void FontsPage::on_createFontsConfButton_clicked()
Expand Down

0 comments on commit eafd83f

Please sign in to comment.