aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-08 19:31:05 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-08 20:50:42 -0800
commit7f99d9e9c3d8fbfd4178ed57ee792832b6a81f51 (patch)
tree6a8791795d638f806f05cead1fc329a4d803f6b5 /qt-mobile
parent308b69359d0c591d3b98caaaae21de9e672b4a9a (diff)
downloadsubsurface-7f99d9e9c3d8fbfd4178ed57ee792832b6a81f51.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qmlmanager.cpp11
-rw-r--r--qt-mobile/qmlmanager.h5
2 files changed, 16 insertions, 0 deletions
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 <QObject>
#include <QString>
#include <QNetworkAccessManager>
+#include <QScreen>
#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