summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-11-24 06:17:35 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2014-11-25 22:18:15 +0100
commit02e20f772d4e07c0eed80d1aa11938787b763eca (patch)
tree6fc1cf14a0b641189181d1b7cc82deb5a0e0e33f /src/plugins/platforms/android
parent77f800bad71f093739ffdab7ac088194978deceb (diff)
[QAndroidPlatformTheme] Get rid of static QFont
QFont is not POD and shouldn't be instantiated statically, otherwise we could end up with UB during qApp destruction. Change-Id: I2372c7a643eb3007957ab2b798732c1a18fd0ae5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/android')
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp7
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.h2
2 files changed, 6 insertions, 3 deletions
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 <qpa/qplatformtheme.h>
+#include <QtGui/qfont.h>
#include <QtGui/qpalette.h>
#include <QJsonObject>
@@ -73,6 +74,7 @@ public:
private:
std::shared_ptr<AndroidStyle> m_androidStyleData;
QPalette m_defaultPalette;
+ QFont m_systemFont;
};
QT_END_NAMESPACE