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>
This commit is contained in:
Dirk Hohndel 2016-03-08 19:31:05 -08:00
parent 308b69359d
commit 7f99d9e9c3
2 changed files with 16 additions and 0 deletions

View file

@ -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);
}

View file

@ -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