Add shortcuts for using user's preferred fixed font in MiniQtHelper

This commit is contained in:
baldurk
2026-08-31 11:27:30 +01:00
parent da8132b69c
commit 0690269cb7
2 changed files with 11 additions and 2 deletions
+3
View File
@@ -711,6 +711,9 @@ this will do nothing
DOCUMENT(R"(Change the font properties of a widget.
The font string can be set either to '_default' or '_fixed' to choose the user-selected default
font or monospaced fonts respectively.
:param QWidget widget: The widget to change font of.
:param str font: The new font family to use, or an empty string to leave the font family the same.
:param int fontSize: The new font point size to use, or 0 to leave the size the same.
+8 -2
View File
@@ -439,10 +439,16 @@ void MiniQtHelper::SetWidgetFont(QWidget *widget, const rdcstr &font, int32_t fo
if(!widget)
return;
QString fontFamily = font;
if(font == "_default")
fontFamily = Formatter::PreferredFont().family();
if(font == "_fixed")
fontFamily = Formatter::FixedFont().family();
QFont f = widget->font();
if(!font.empty())
f.setFamily(font);
if(!fontFamily.isEmpty())
f.setFamily(fontFamily);
if(fontSize != 0)
f.setPointSize(fontSize);
f.setBold(bold);