mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-05 05:15:47 +00:00
Add shortcuts for using user's preferred fixed font in MiniQtHelper
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user