summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qmlmanager.cpp10
-rw-r--r--mobile-widgets/qmlmanager.h1
-rw-r--r--subsurface-mobile-helper.cpp1
3 files changed, 11 insertions, 1 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index a834259f7..d24a4579d 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -85,10 +85,10 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
m_updateSelectedDive(-1),
m_selectedDiveTimestamp(0),
m_credentialStatus(UNKNOWN),
- m_lastDevicePixelRatio(1.0),
alreadySaving(false)
{
m_instance = this;
+ m_lastDevicePixelRatio = qApp->devicePixelRatio();
connect(qobject_cast<QApplication *>(QApplication::instance()), &QApplication::applicationStateChanged, this, &QMLManager::applicationStateChanged);
appendTextToLog(getUserAgent());
appendTextToLog(QStringLiteral("build with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion()));
@@ -1412,6 +1412,14 @@ qreal QMLManager::lastDevicePixelRatio()
return m_lastDevicePixelRatio;
}
+void QMLManager::setDevicePixelRatio(qreal dpr, QScreen *screen)
+{
+ if (m_lastDevicePixelRatio != dpr) {
+ m_lastDevicePixelRatio = dpr;
+ emit sendScreenChanged(screen);
+ }
+}
+
void QMLManager::screenChanged(QScreen *screen)
{
m_lastDevicePixelRatio = screen->devicePixelRatio();
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 8c5b02fa1..04f4a40dd 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -154,6 +154,7 @@ public slots:
void refreshDiveList();
void screenChanged(QScreen *screen);
qreal lastDevicePixelRatio();
+ void setDevicePixelRatio(qreal dpr, QScreen *screen);
void appendTextToLog(const QString &newText);
void quit();
void hasLocationSourceChanged();
diff --git a/subsurface-mobile-helper.cpp b/subsurface-mobile-helper.cpp
index 05155b3b4..8263f96c5 100644
--- a/subsurface-mobile-helper.cpp
+++ b/subsurface-mobile-helper.cpp
@@ -79,6 +79,7 @@ void run_ui()
QScreen *screen = qml_window->screen();
QObject::connect(qml_window, &QQuickWindow::screenChanged, QMLManager::instance(), &QMLManager::screenChanged);
QMLManager *manager = QMLManager::instance();
+ manager->setDevicePixelRatio(qml_window->devicePixelRatio(), qml_window->screen());
manager->dlSortModel = sortModel;
manager->screenChanged(screen);
qDebug() << "qqwindow screen has ldpi/pdpi" << screen->logicalDotsPerInch() << screen->physicalDotsPerInch();