diff --git a/profile-widget/qmlprofile.cpp b/profile-widget/qmlprofile.cpp index 08f5836af..ca0293c3c 100644 --- a/profile-widget/qmlprofile.cpp +++ b/profile-widget/qmlprofile.cpp @@ -24,9 +24,20 @@ QMLProfile::QMLProfile(QQuickItem *parent) : m_profileWidget->setPrintMode(true); m_profileWidget->setFontPrintScale(fontScale); connect(QMLManager::instance(), &QMLManager::sendScreenChanged, this, &QMLProfile::screenChanged); + connect(this, &QMLProfile::scaleChanged, this, &QMLProfile::triggerUpdate); setDevicePixelRatio(QMLManager::instance()->lastDevicePixelRatio()); } +// we need this so we can connect update() to the scaleChanged() signal - which the connect above cannot do +// directly as it chokes on the default parameter for update(). +// If the scale changes we may need to change our offsets to ensure that we still only show a subset of +// the profile and not empty space around it, which the paint() method below will take care of, which will +// eventually get called after we call update() +void QMLProfile::triggerUpdate() +{ + update(); +} + void QMLProfile::paint(QPainter *painter) { QElapsedTimer timer; diff --git a/profile-widget/qmlprofile.h b/profile-widget/qmlprofile.h index 2798fa733..15bfac0c0 100644 --- a/profile-widget/qmlprofile.h +++ b/profile-widget/qmlprofile.h @@ -28,6 +28,8 @@ public: public slots: void setMargin(int margin); void screenChanged(QScreen *screen); + void triggerUpdate(); + private: int m_diveId; qreal m_devicePixelRatio;