subsurface/qt-ui/printlayout.h
Lubomir I. Ivanov feda96cec5 PrintLayout: disable the QPainter scaling
This is wrong because we don't really need to scale. We already
have the estimated page dimentions in pixels, so taking the
quotient of the printer DPI and screen DPI and then scaling
(probably up) our rendered widgets via the QPainter introduces
blur (due to the oversampling), and a performance penalty.

By rendering at the exact dimensions we ensure that the widgets
are crisp at a 100% printout.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 21:06:19 -07:00

49 lines
1.2 KiB
C++

#ifndef PRINTLAYOUT_H
#define PRINTLAYOUT_H
#include <QObject>
#include <QList>
#include <QVector>
#include <QRect>
class QPrinter;
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, pageW, pageH;
QRect pageRect;
QVector<QString> tablePrintColumnNames;
unsigned int tablePrintHeadingBackground;
QList<unsigned int> tablePrintColumnWidths;
unsigned int profilePrintTableMaxH;
QList<unsigned int> profilePrintColumnWidths, profilePrintRowHeights;
void setup();
int estimateTotalDives() const;
void printProfileDives(int divesPerRow, int divesPerColumn);
QTableView *createProfileTable(ProfilePrintModel *model, const int tableW, const qreal fitNotesToHeight = 0.0);
void printTable();
void addTablePrintDataRow(TablePrintModel *model, int row, struct dive *dive) const;
void addTablePrintHeadingRow(TablePrintModel *model, int row) const;
signals:
void signalProgress(int);
};
#endif // PRINTLAYOUT_H