From 28f1c1b9ef10fc3a49a64a535c7747a009939453 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 18 Aug 2011 11:04:06 +0200 Subject: Restore feature compatibility with QPrinter in QTextDocument::print Add a margin method to QPagedPaintDevice. The other variables required are stored in QPagedPaintDevicePrivate without a public API for now. This needs cleaning up once we have a new printing system. Change-Id: Id3f2d7ac7f3cbce8619072a897d91f3a588add64 Reviewed-on: http://codereview.qt.nokia.com/3211 Reviewed-by: Qt Sanity Bot Reviewed-by: Gunnar Sletta --- src/gui/painting/qpagedpaintdevice.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/gui/painting/qpagedpaintdevice.cpp') diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp index dd756db023..e5b2c0716e 100644 --- a/src/gui/painting/qpagedpaintdevice.cpp +++ b/src/gui/painting/qpagedpaintdevice.cpp @@ -46,6 +46,7 @@ class QPagedPaintDevicePrivate public: QPagedPaintDevice::PageSize pageSize; QSizeF pageSizeMM; + QPagedPaintDevice::Margins margins; }; static const struct { @@ -102,7 +103,6 @@ static const struct { QPagedPaintDevice::QPagedPaintDevice() : d(new QPagedPaintDevicePrivate) { - setPageSize(A4); } /*! @@ -201,3 +201,27 @@ QSizeF QPagedPaintDevice::pageSizeMM() const return d->pageSizeMM; } +/*! + Sets the margins to be used to \a margins. + + Margins are specified in millimeters. + + The margins are purely a hint to the drawing method. They don't affect the + coordinate system or clipping. + + \sa margins + */ +void QPagedPaintDevice::setMargins(const Margins &margins) +{ + d->margins = margins; +} + +/*! + returns the current margins of the paint device. The default is 0. + + /sa setMargins + */ +QPagedPaintDevice::Margins QPagedPaintDevice::margins() const +{ + return d->margins; +} -- cgit v1.2.3