diff options
Diffstat (limited to 'qt-mobile')
-rw-r--r-- | qt-mobile/qmlprofile.cpp | 11 | ||||
-rw-r--r-- | qt-mobile/qmlprofile.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/qt-mobile/qmlprofile.cpp b/qt-mobile/qmlprofile.cpp index 512aa6a3a..e382e4e07 100644 --- a/qt-mobile/qmlprofile.cpp +++ b/qt-mobile/qmlprofile.cpp @@ -1,7 +1,9 @@ #include "qmlprofile.h" +#include "qmlmanager.h" #include "profile-widget/profilewidget2.h" #include "subsurface-core/dive.h" #include <QTransform> +#include <QScreen> QMLProfile::QMLProfile(QQuickItem *parent) : QQuickPaintedItem(parent), @@ -13,7 +15,8 @@ QMLProfile::QMLProfile(QQuickItem *parent) : m_profileWidget->setProfileState(); m_profileWidget->setPrintMode(true); m_profileWidget->setFontPrintScale(0.8); - //m_profileWidget->setGeometry(this->geometry()); + connect(QMLManager::instance(), &QMLManager::sendScreenChanged, this, &QMLProfile::screenChanged); + setDevicePixelRatio(QMLManager::instance()->lastDevicePixelRatio()); } QMLProfile::~QMLProfile() @@ -65,6 +68,12 @@ void QMLProfile::setDevicePixelRatio(qreal dpr) { if (dpr != m_devicePixelRatio) { m_devicePixelRatio = dpr; + m_profileWidget->setFontPrintScale(0.8 * dpr); emit devicePixelRatioChanged(); } } + +void QMLProfile::screenChanged(QScreen *screen) +{ + setDevicePixelRatio(screen->devicePixelRatio()); +} diff --git a/qt-mobile/qmlprofile.h b/qt-mobile/qmlprofile.h index 35332ce8d..c8a77d700 100644 --- a/qt-mobile/qmlprofile.h +++ b/qt-mobile/qmlprofile.h @@ -24,11 +24,13 @@ public: public slots: void setMargin(int margin); + void screenChanged(QScreen *screen); private: QString m_diveId; qreal m_devicePixelRatio; int m_margin; ProfileWidget2 *m_profileWidget; + signals: void rightAlignedChanged(); void diveIdChanged(); |