mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-02 23:20:20 +00:00
e727b899a6
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>
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#ifndef PRINTLAYOUT_H
|
|
#define PRINTLAYOUT_H
|
|
|
|
#include <QObject>
|
|
#include <QPrinter>
|
|
#include <QList>
|
|
|
|
class QTableView;
|
|
class PrintDialog;
|
|
class TablePrintModel;
|
|
class ProfilePrintModel;
|
|
struct dive;
|
|
|
|
class PrintLayout : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
PrintLayout(PrintDialog *, QPrinter *, struct options *);
|
|
void print();
|
|
|
|
private:
|
|
PrintDialog *dialog;
|
|
QPrinter *printer;
|
|
struct options *printOptions;
|
|
|
|
int screenDpiX, screenDpiY, printerDpi, scaledPageW, scaledPageH;
|
|
qreal scaleX, scaleY;
|
|
QRect pageRect;
|
|
|
|
QList<QString> tablePrintColumnNames;
|
|
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;
|
|
|
|
QPixmap convertPixmapToGrayscale(QPixmap) const;
|
|
};
|
|
|
|
#endif
|