profile: for printing/mobile access ProfileScene directly

Instead of using the interactive ProfileWidget2, just
use the ProfileScene to render the profile for printing,
export and mobile. One layer (QWidget) less.

This removes all the kludges for handling DPR on mobile.
Thus, the rendering will now be off and have to be fixed
by redoing the scaling code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-08-04 07:27:41 +02:00 committed by Dirk Hohndel
parent 84ebd1d67a
commit 51dc5113c2
10 changed files with 70 additions and 136 deletions

View file

@ -12,7 +12,7 @@
#include "qt-models/cylindermodel.h"
#include "qt-models/models.h"
#include "profile-widget/profilewidget2.h"
#include "profile-widget/profilescene.h"
#include "qt-models/diveplannermodel.h"
#include <QShortcut>
@ -609,10 +609,8 @@ void PlannerWidgets::printDecoPlan()
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::SmoothPixmapTransform);
auto profile = std::make_unique<ProfileWidget2>(DivePlannerPointsModel::instance(), 1.0, nullptr);
profile->setPlanState(&displayed_dive, 0);
profile->plotDive(&displayed_dive, 0, true, true);
profile->setPrintMode();
auto profile = std::make_unique<ProfileScene>(1.0, true, false);
profile->plotDive(&displayed_dive, 0, DivePlannerPointsModel::instance(), true, true);
profile->draw(&painter, QRect(0, 0, pixmap.width(), pixmap.height()));
QByteArray byteArray;