mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mobile/Android: ensure the onePlus font has point size
Otherwise this throws off the calculation of the gridUnit on onePlus devices. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ecf3ac12eb
commit
11ae662545
1 changed files with 4 additions and 0 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include "profile-widget/qmlprofile.h"
|
#include "profile-widget/qmlprofile.h"
|
||||||
#include "core/downloadfromdcthread.h"
|
#include "core/downloadfromdcthread.h"
|
||||||
#include "core/subsurfacestartup.h" // for testqml
|
#include "core/subsurfacestartup.h" // for testqml
|
||||||
|
#include "core/metrics.h"
|
||||||
#include "qt-models/diveimportedmodel.h"
|
#include "qt-models/diveimportedmodel.h"
|
||||||
#else
|
#else
|
||||||
#include "desktop-widgets/mainwindow.h"
|
#include "desktop-widgets/mainwindow.h"
|
||||||
|
@ -73,6 +74,8 @@ void run_ui()
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
// work around an odd interaction between the OnePlus flavor of Android and Qt font handling
|
// work around an odd interaction between the OnePlus flavor of Android and Qt font handling
|
||||||
if (getAndroidHWInfo().contains("/OnePlus/")) {
|
if (getAndroidHWInfo().contains("/OnePlus/")) {
|
||||||
|
QFontInfo qfi(defaultModelFont());
|
||||||
|
double basePointSize = qfi.pointSize();
|
||||||
QFontDatabase db;
|
QFontDatabase db;
|
||||||
int id = QFontDatabase::addApplicationFont(":/fonts/Roboto-Regular.ttf");
|
int id = QFontDatabase::addApplicationFont(":/fonts/Roboto-Regular.ttf");
|
||||||
QStringList fontFamilies = QFontDatabase::applicationFontFamilies(id);
|
QStringList fontFamilies = QFontDatabase::applicationFontFamilies(id);
|
||||||
|
@ -80,6 +83,7 @@ void run_ui()
|
||||||
QString family = fontFamilies.at(0);
|
QString family = fontFamilies.at(0);
|
||||||
QFont newDefaultFont;
|
QFont newDefaultFont;
|
||||||
newDefaultFont.setFamily(family);
|
newDefaultFont.setFamily(family);
|
||||||
|
newDefaultFont.setPointSize(basePointSize);
|
||||||
(static_cast<QApplication *>(QCoreApplication::instance()))->setFont(newDefaultFont);
|
(static_cast<QApplication *>(QCoreApplication::instance()))->setFont(newDefaultFont);
|
||||||
qDebug() << "Detected OnePlus device, trying to force bundled font" << family;
|
qDebug() << "Detected OnePlus device, trying to force bundled font" << family;
|
||||||
QFont defaultFont = (static_cast<QApplication *>(QCoreApplication::instance()))->font();
|
QFont defaultFont = (static_cast<QApplication *>(QCoreApplication::instance()))->font();
|
||||||
|
|
Loading…
Reference in a new issue