diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-11-08 18:42:56 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-11-09 13:22:29 +0100 |
commit | 2bdc027f5c6be9c551d40c80e510b19b6e2939a7 (patch) | |
tree | e74a28ffa2f358d1f5b5dec68f282bec79e5c42c /src/plugins/styles/mac/qmacstyle_mac_p_p.h | |
parent | 963f3c678ca8282bd3e1d8af5f8669baaddb1686 (diff) |
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 <samuel.gaist@idiap.ch>
Diffstat (limited to 'src/plugins/styles/mac/qmacstyle_mac_p_p.h')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac_p_p.h | 3 |
1 files changed, 1 insertions, 2 deletions
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<CocoaControl, NSView *> cocoaControls; mutable QHash<CocoaControl, NSCell *> cocoaCells; - QFont smallSystemFont; - QFont miniSystemFont; + std::optional<QFont> smallSystemFont; QMacKeyValueObserver appearanceObserver; }; |