GUI: OptionsDialog: Replace verbose two-option font selector with simple combobox with Custom... choice

This commit is contained in:
Luke Dashjr
2021-12-02 23:40:15 +00:00
parent 98e9ac5199
commit a17fd33edd
4 changed files with 92 additions and 127 deletions

View File

@@ -490,18 +490,23 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
}
}
QFont OptionsModel::getFontForMoney() const
QFont OptionsModel::getFontForChoice(const FontChoice& fc)
{
QFont f;
if (std::holds_alternative<FontChoiceAbstract>(m_font_money)) {
f = GUIUtil::fixedPitchFont(m_font_money != UseBestSystemFont);
if (std::holds_alternative<FontChoiceAbstract>(fc)) {
f = GUIUtil::fixedPitchFont(fc != UseBestSystemFont);
f.setWeight(QFont::Bold);
} else {
f = std::get<QFont>(m_font_money);
f = std::get<QFont>(fc);
}
return f;
}
QFont OptionsModel::getFontForMoney() const
{
return getFontForChoice(m_font_money);
}
bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::string& suffix)
{
auto changed = [&] { return value.isValid() && value != getOption(option, suffix); };