summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpdf_p.h
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-12-29 20:19:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-17 13:45:49 +0100
commit0c04b31d2715f68aa883107b4aa593fd95aefdfe (patch)
treeb882b4835f0acd3b188e473c99170ac12951eacc /src/gui/painting/qpdf_p.h
parent4ab55a01e96b6ac398d3a9afa2c93032e305f30b (diff)
QPdfPaintEngine - Use QPageLayout and QPageSize
Switch internals of QPdfPageEngine and derived classes to use QPageLayout and QPageSize to make handling of page layout and size more consistent by removing multiple implementations. In particular remove all use of the QPdf namespace version of page size. Change-Id: Ie820340015e8812c8162bd1a257dd0f51f4f0b85 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/painting/qpdf_p.h')
-rw-r--r--src/gui/painting/qpdf_p.h39
1 files changed, 14 insertions, 25 deletions
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index ae2d4b00ac..e9459eff83 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -64,6 +64,7 @@
#include "private/qpaintengine_p.h"
#include "private/qfontengine_p.h"
#include "private/qfontsubset_p.h"
+#include "qpagelayout.h"
// #define USE_NATIVE_GRADIENTS
@@ -179,7 +180,9 @@ public:
~QPdfEngine() {}
void setOutputFilename(const QString &filename);
- inline void setResolution(int resolution);
+
+ void setResolution(int resolution);
+ int resolution() const;
// reimplementations QPaintEngine
bool begin(QPaintDevice *pdev);
@@ -207,6 +210,14 @@ public:
// Printer stuff...
bool newPage();
+ // Page layout stuff
+ void setPageLayout(const QPageLayout &pageLayout);
+ void setPageSize(const QPageSize &pageSize);
+ void setPageOrientation(QPageLayout::Orientation orientation);
+ void setPageMargins(const QMarginsF &margins, QPageLayout::Unit units = QPageLayout::Point);
+
+ QPageLayout pageLayout() const;
+
void setPen();
void setBrush();
void setupGraphicsState(QPaintEngine::DirtyFlags flags);
@@ -224,19 +235,6 @@ public:
inline uint requestObject() { return currentObject++; }
- QRect paperRect() const;
- QRect pageRect() const;
- void setPaperSize(const QSizeF &pageSizeMM);
-
- int width() const {
- QRect r = paperRect();
- return qRound(r.width()*72./resolution);
- }
- int height() const {
- QRect r = paperRect();
- return qRound(r.height()*72./resolution);
- }
-
void writeHeader();
void writeTail();
@@ -278,15 +276,12 @@ public:
QString outputFileName;
QString title;
QString creator;
- bool fullPage;
bool embedFonts;
int resolution;
- bool landscape;
bool grayscale;
- // in postscript points
- QSizeF paperSize;
- qreal leftMargin, topMargin, rightMargin, bottomMargin;
+ // Page layout: size, orientation and margins
+ QPageLayout m_pageLayout;
private:
#ifdef USE_NATIVE_GRADIENTS
@@ -325,12 +320,6 @@ private:
QHash<QPair<uint, uint>, uint > alphaCache;
};
-void QPdfEngine::setResolution(int resolution)
-{
- Q_D(QPdfEngine);
- d->resolution = resolution;
-}
-
QT_END_NAMESPACE
#endif // QT_NO_PDF