diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 6b25cd844..f744aebfe 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -609,13 +609,15 @@ void PlannerWidgets::printDecoPlan() painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::SmoothPixmapTransform); - ProfileWidget2 *profile = MainWindow::instance()->graphics; - QSize origSize = profile->size(); + // TODO: Annoyingly, this still needs a parent window? Otherwise, + // the profile is shown as its own window, when calling show() below. + auto profile = std::make_unique(DivePlannerPointsModel::instance(), MainWindow::instance()); + profile->show(); // Ominous: if the scene isn't shown, parts of the plot are missing. Needs investigation. profile->resize(renderSize.toSize()); + profile->setPlanState(&displayed_dive, 0); + profile->plotDive(&displayed_dive, 0, true, true); profile->setPrintMode(true); profile->render(&painter); - profile->resize(origSize); - profile->setPrintMode(false); QByteArray byteArray; QBuffer buffer(&byteArray);