[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>
This commit is contained in:
parent
77f800bad7
commit
02e20f772d
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user