From 0690269cb75e3cb35762f64b16ea61afc901c388 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 31 Aug 2026 11:26:21 +0100 Subject: [PATCH] Add shortcuts for using user's preferred fixed font in MiniQtHelper --- qrenderdoc/Code/Interface/Extensions.h | 3 +++ qrenderdoc/Code/MiniQtHelper.cpp | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/qrenderdoc/Code/Interface/Extensions.h b/qrenderdoc/Code/Interface/Extensions.h index bb4890975..e4a6608ec 100644 --- a/qrenderdoc/Code/Interface/Extensions.h +++ b/qrenderdoc/Code/Interface/Extensions.h @@ -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. diff --git a/qrenderdoc/Code/MiniQtHelper.cpp b/qrenderdoc/Code/MiniQtHelper.cpp index 88f605d3f..135f546c6 100644 --- a/qrenderdoc/Code/MiniQtHelper.cpp +++ b/qrenderdoc/Code/MiniQtHelper.cpp @@ -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);