Print: provide means to print profile tables

This patch adds a couple of classes and some other modifications
in PrintLayout that handle the printing of tables under a profile.

models.h : ProfilePrintModel
The class uses a 'struct *dive' to output all required data
for a certain dive at specific rows and columns. It also handles
font formatting and text alignment.

modeldelagatates.h : ProfilePrintDelegate
The class is used only for drawing a custom grid for profile tables.

PrintLayout::createProfileTable()
The function is used to create and setup the profile table object

PrintLayout::printProfileDives()
The function now has correct padding of dive profiles on a page
and also the printing of actual tables below them.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2013-10-03 17:50:40 +03:00 committed by Dirk Hohndel
parent 374f3d0de6
commit e727b899a6
6 changed files with 402 additions and 32 deletions

View file

@ -5,8 +5,10 @@
#include <QPrinter>
#include <QList>
class QTableView;
class PrintDialog;
class TablePrintModel;
class ProfilePrintModel;
struct dive;
class PrintLayout : public QObject {
@ -19,7 +21,6 @@ public:
private:
PrintDialog *dialog;
QPrinter *printer;
QPainter *painter;
struct options *printOptions;
int screenDpiX, screenDpiY, printerDpi, scaledPageW, scaledPageH;
@ -27,11 +28,14 @@ private:
QRect pageRect;
QList<QString> tablePrintColumnNames;
QList<unsigned int> tablePrintColumnWidths;
unsigned int tablePrintHeadingBackground;
QList<unsigned int> tablePrintColumnWidths;
unsigned int profilePrintTableMaxH;
QList<unsigned int> profilePrintColumnWidths, profilePrintRowHeights;
void setup();
void printProfileDives(int divesPerRow, int divesPerColumn);
QTableView *createProfileTable(ProfilePrintModel *model, const int tableW);
void printTable();
void addTablePrintDataRow(TablePrintModel *model, int row, struct dive *dive) const;
void addTablePrintHeadingRow(TablePrintModel *model, int row) const;