aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/printlayout.cpp
diff options
context:
space:
mode:
authorGravatar Patrick Valsecchi <patrick@thus.ch>2013-10-16 10:39:15 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-16 07:02:06 -0700
commit4f23ff144ffe962349b3c155690991525a399260 (patch)
tree393e08349adc5645c5325619c5c43251a67f54ba /qt-ui/printlayout.cpp
parent29795ef5747303f839ce5f0d896f71ff425e6766 (diff)
downloadsubsurface-4f23ff144ffe962349b3c155690991525a399260.tar.gz
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 <patrick@thus.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/printlayout.cpp')
-rw-r--r--qt-ui/printlayout.cpp17
1 files 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++;
}