summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qmlprofile.cpp10
-rw-r--r--mobile-widgets/qmlprofile.h6
2 files changed, 4 insertions, 12 deletions
diff --git a/mobile-widgets/qmlprofile.cpp b/mobile-widgets/qmlprofile.cpp
index 9ed3e36a5..d6ea5bb50 100644
--- a/mobile-widgets/qmlprofile.cpp
+++ b/mobile-widgets/qmlprofile.cpp
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "qmlprofile.h"
#include "qmlmanager.h"
-#include "profile-widget/profilewidget2.h"
#include "core/subsurface-string.h"
#include "core/metrics.h"
#include <QTransform>
@@ -10,10 +9,10 @@
QMLProfile::QMLProfile(QQuickItem *parent) :
QQuickPaintedItem(parent),
m_devicePixelRatio(1.0),
- m_margin(0)
+ m_margin(0),
+ m_profileWidget(new ProfileWidget2)
{
setAntialiasing(true);
- m_profileWidget = new ProfileWidget2(0);
m_profileWidget->setProfileState();
m_profileWidget->setPrintMode(true);
m_profileWidget->setFontPrintScale(0.8);
@@ -21,11 +20,6 @@ QMLProfile::QMLProfile(QQuickItem *parent) :
setDevicePixelRatio(QMLManager::instance()->lastDevicePixelRatio());
}
-QMLProfile::~QMLProfile()
-{
- m_profileWidget->deleteLater();
-}
-
void QMLProfile::paint(QPainter *painter)
{
// let's look at the intended size of the content and scale our scene accordingly
diff --git a/mobile-widgets/qmlprofile.h b/mobile-widgets/qmlprofile.h
index 88e48b7f2..bc5e127fc 100644
--- a/mobile-widgets/qmlprofile.h
+++ b/mobile-widgets/qmlprofile.h
@@ -2,10 +2,9 @@
#ifndef QMLPROFILE_H
#define QMLPROFILE_H
+#include "profile-widget/profilewidget2.h"
#include <QQuickPaintedItem>
-class ProfileWidget2;
-
class QMLProfile : public QQuickPaintedItem
{
Q_OBJECT
@@ -14,7 +13,6 @@ class QMLProfile : public QQuickPaintedItem
public:
explicit QMLProfile(QQuickItem *parent = 0);
- virtual ~QMLProfile();
void paint(QPainter *painter);
@@ -30,7 +28,7 @@ private:
QString m_diveId;
qreal m_devicePixelRatio;
int m_margin;
- ProfileWidget2 *m_profileWidget;
+ QScopedPointer<ProfileWidget2> m_profileWidget;
signals:
void rightAlignedChanged();