Skip to content
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
18 changes: 12 additions & 6 deletions src/qt/optionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,16 +564,22 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
case FontScale:
return settings.value("fontScale");
case FontWeightNormal: {
QFont::Weight weight{GUIUtil::g_font_registry.GetWeightNormalDefault()};
GUIUtil::weightFromArg(settings.value("fontWeightNormal").toInt(), weight);
int nIndex = GUIUtil::g_font_registry.WeightToIdx(weight);
int nIndex = [&]() -> int {
if (QFont::Weight weight; GUIUtil::weightFromArg(settings.value("fontWeightNormal").toInt(), weight) && GUIUtil::g_font_registry.IsValidWeight(weight)) {
return GUIUtil::g_font_registry.WeightToIdx(weight);
}
return GUIUtil::g_font_registry.WeightToIdx(GUIUtil::g_font_registry.GetWeightNormalDefault());
}();
assert(nIndex != -1);
return nIndex;
}
case FontWeightBold: {
QFont::Weight weight{GUIUtil::g_font_registry.GetWeightBoldDefault()};
GUIUtil::weightFromArg(settings.value("fontWeightBold").toInt(), weight);
int nIndex = GUIUtil::g_font_registry.WeightToIdx(weight);
int nIndex = [&]() -> int {
if (QFont::Weight weight; GUIUtil::weightFromArg(settings.value("fontWeightBold").toInt(), weight) && GUIUtil::g_font_registry.IsValidWeight(weight)) {
return GUIUtil::g_font_registry.WeightToIdx(weight);
}
return GUIUtil::g_font_registry.WeightToIdx(GUIUtil::g_font_registry.GetWeightBoldDefault());
}();
assert(nIndex != -1);
return nIndex;
}
Expand Down
Loading