diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index f9f2e4a944..8cece443b1 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -347,6 +347,9 @@ QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *an m_androidStyleData = loadAndroidStyle(&m_defaultPalette); QGuiApplication::setPalette(m_defaultPalette); androidPlatformNativeInterface->m_androidStyle = m_androidStyleData; + + // default in case the style has not set a font + m_systemFont = QFont(QLatin1String("Roboto"), 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi } QPlatformMenuBar *QAndroidPlatformTheme::createPlatformMenuBar() const @@ -429,10 +432,8 @@ const QFont *QAndroidPlatformTheme::font(Font type) const return &(it.value()); } - // default in case the style has not set a font - static QFont systemFont("Roboto", 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi if (type == QPlatformTheme::SystemFont) - return &systemFont; + return &m_systemFont; return 0; } diff --git a/src/plugins/platforms/android/qandroidplatformtheme.h b/src/plugins/platforms/android/qandroidplatformtheme.h index 334e86ad7a..e842e672d6 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.h +++ b/src/plugins/platforms/android/qandroidplatformtheme.h @@ -35,6 +35,7 @@ #define QANDROIDPLATFORMTHEME_H #include +#include #include #include @@ -73,6 +74,7 @@ public: private: std::shared_ptr m_androidStyleData; QPalette m_defaultPalette; + QFont m_systemFont; }; QT_END_NAMESPACE