From 7f99d9e9c3d8fbfd4178ed57ee792832b6a81f51 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 8 Mar 2016 19:31:05 -0800 Subject: QMLManager: helper function for devivePixelRatio This allows us to use the single manager object to keep track of the dpr of the screen and to pass it on if it changes (or when it first becomes known). Signed-off-by: Dirk Hohndel --- qt-mobile/qmlmanager.cpp | 11 +++++++++++ qt-mobile/qmlmanager.h | 5 +++++ 2 files changed, 16 insertions(+) (limited to 'qt-mobile') diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index 9d506859d..f0e6dcca4 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -954,3 +954,14 @@ void QMLManager::setAccessingCloud(bool status) m_accessingCloud = status; emit accessingCloudChanged(); } + +qreal QMLManager::lastDevicePixelRatio() +{ + return m_lastDevicePixelRatio; +} + +void QMLManager::screenChanged(QScreen *screen) +{ + m_lastDevicePixelRatio = screen->devicePixelRatio(); + emit sendScreenChanged(screen); +} diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h index ff3507991..04374bde6 100644 --- a/qt-mobile/qmlmanager.h +++ b/qt-mobile/qmlmanager.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "gpslocation.h" @@ -115,6 +116,8 @@ public slots: QString getVersion() const; void deleteGpsFix(quint64 when); void refreshDiveList(); + void screenChanged(QScreen *screen); + qreal lastDevicePixelRatio(); private: QString m_cloudUserName; @@ -136,6 +139,7 @@ private: struct dive_trip *deletedTrip; bool m_accessingCloud; credentialStatus_t m_credentialStatus; + qreal m_lastDevicePixelRatio; signals: void cloudUserNameChanged(); @@ -150,6 +154,7 @@ signals: void startPageTextChanged(); void credentialStatusChanged(); void accessingCloudChanged(); + void sendScreenChanged(QScreen *screen); }; #endif -- cgit v1.2.3-70-g09d2