From 4f23ff144ffe962349b3c155690991525a399260 Mon Sep 17 00:00:00 2001 From: Patrick Valsecchi Date: Wed, 16 Oct 2013 10:39:15 +0200 Subject: [PATCH] Prettier printing Going through pixmaps for the profile was not needed and was making our prints look very pixelated. In Qt4, QWidget child classes are printed as bitmaps. So appart from changing the code to print the tables to use a QGraphicsView instead, there is nothing we can do, so the rest of the printing is still done as bitmaps. Signed-off-by: Patrick Valsecchi Signed-off-by: Dirk Hohndel --- qt-ui/printlayout.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp index 76c33a330..f539c89b3 100644 --- a/qt-ui/printlayout.cpp +++ b/qt-ui/printlayout.cpp @@ -162,18 +162,19 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn) printer->newPage(); } } + QTransform origTransform = painter.transform(); + // draw a profile + painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile); profile->plot(dive, true); - QPixmap profilePm = QPixmap::grabWidget(profile); // Qt4 - painter.drawPixmap((scaledW + padW) * col, - (scaledH + padH) * row + yOffsetProfile, - profilePm); + profile->render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT)); + painter.setTransform(origTransform); + // draw a table + painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetTable); model.setDive(dive); - QPixmap tablePm = QPixmap::grabWidget(table); // Qt4 - painter.drawPixmap((scaledW + padW) * col, - (scaledH + padH) * row + yOffsetTable, - tablePm); + table->render(&painter); + painter.setTransform(origTransform); col++; }