From 2bdc027f5c6be9c551d40c80e510b19b6e2939a7 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 8 Nov 2022 18:42:56 +0100 Subject: macOS: delay initialization of small font During construction of a QStyle, QApplication might not yet be initialized, e.g. when calling QApplication::setStyle("macOS") before constructing QApplication. In that case, we cannot access the platform theme. We don't just want to skip initializing the small font either though. Store the smallSystemFont as a std::optional so that we can initialize it once, when the first widget gets polished. As a drive-by, remove the unused miniSystemFont variable. Fixes: QTBUG-108047 Pick-to: 6.4 6.2 Change-Id: Id750770a563611fdbc6c7031fe102a99ea692be7 Reviewed-by: Samuel Gaist --- src/plugins/styles/mac/qmacstyle_mac_p_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/plugins/styles/mac/qmacstyle_mac_p_p.h') diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 8dc8d659e7..e3f1e39d19 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -262,8 +262,7 @@ public: mutable QHash cocoaControls; mutable QHash cocoaCells; - QFont smallSystemFont; - QFont miniSystemFont; + std::optional smallSystemFont; QMacKeyValueObserver appearanceObserver; }; -- cgit v1.2.3