Render the table print in curves.

We can use QPicture to record the painting done by a QPainter and it will
be saved in vector format, then we can simply paint that.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-07-11 20:22:19 -03:00 committed by Dirk Hohndel
parent e18f4dfdee
commit 8cd4a5f3d1

View file

@ -6,6 +6,8 @@
#include <QTableView> #include <QTableView>
#include <QHeaderView> #include <QHeaderView>
#include <QPointer> #include <QPointer>
#include <QPicture>
#include "mainwindow.h" #include "mainwindow.h"
#include "../dive.h" #include "../dive.h"
#include "../display.h" #include "../display.h"
@ -136,6 +138,9 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
painter.setRenderHint(QPainter::SmoothPixmapTransform); painter.setRenderHint(QPainter::SmoothPixmapTransform);
painter.scale(scaleX, scaleY); painter.scale(scaleX, scaleY);
QPicture pic;
QPainter picPainter;
// setup the profile widget // setup the profile widget
QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics(); QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics();
const int profileFrameStyle = profile->frameStyle(); const int profileFrameStyle = profile->frameStyle();
@ -196,7 +201,10 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
// draw a table // draw a table
painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetTable); painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetTable);
model.setDive(dive); model.setDive(dive);
table->render(&painter); picPainter.begin(&pic);
table->render(&picPainter);
picPainter.end();
painter.drawPicture(QPoint(0,0), pic);
painter.setTransform(origTransform); painter.setTransform(origTransform);
col++; col++;
printed++; printed++;