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>
This commit is contained in:
Patrick Valsecchi 2013-10-16 10:39:15 +02:00 committed by Dirk Hohndel
parent 29795ef574
commit 4f23ff144f

View file

@ -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++;
}