diff --git a/profile-widget/qmlprofile.cpp b/profile-widget/qmlprofile.cpp index a0f68f0db..35ab82ba1 100644 --- a/profile-widget/qmlprofile.cpp +++ b/profile-widget/qmlprofile.cpp @@ -15,20 +15,25 @@ QMLProfile::QMLProfile(QQuickItem *parent) : m_devicePixelRatio(1.0), m_margin(0), m_xOffset(0.0), - m_yOffset(0.0), - m_profileWidget(new ProfileWidget2(nullptr, nullptr)) + m_yOffset(0.0) { + createProfileView(); setAntialiasing(true); setFlags(QQuickItem::ItemClipsChildrenToShape | QQuickItem::ItemHasContents ); - m_profileWidget->setProfileState(nullptr, 0); - m_profileWidget->setPrintMode(true); - m_profileWidget->setFontPrintScale(fontScale); connect(QMLManager::instance(), &QMLManager::sendScreenChanged, this, &QMLProfile::screenChanged); connect(this, &QMLProfile::scaleChanged, this, &QMLProfile::triggerUpdate); connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &QMLProfile::divesChanged); setDevicePixelRatio(QMLManager::instance()->lastDevicePixelRatio()); } +void QMLProfile::createProfileView() +{ + m_profileWidget.reset(new ProfileWidget2(nullptr, nullptr)); + m_profileWidget->setProfileState(nullptr, 0); + m_profileWidget->setPrintMode(true); + m_profileWidget->setFontPrintScale(fontScale * m_devicePixelRatio); +} + // 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 diff --git a/profile-widget/qmlprofile.h b/profile-widget/qmlprofile.h index a67bc8c2f..4762c6d9c 100644 --- a/profile-widget/qmlprofile.h +++ b/profile-widget/qmlprofile.h @@ -38,6 +38,7 @@ private: qreal m_xOffset, m_yOffset; QScopedPointer m_profileWidget; void updateProfile(); + void createProfileView(); private slots: void divesChanged(const QVector &dives, DiveField);