QtPrintSupport: set QPrinter margins also to QPagedPaintDevice
authorTeemu Katajisto <teemu.katajisto@digia.com>
Tue, 12 Jun 2012 11:54:46 +0000 (14:54 +0300)
committerQt by Nokia <qt-info@nokia.com>
Tue, 11 Sep 2012 10:09:47 +0000 (12:09 +0200)
QPagedPaintDevice::setMargins() is virtual method and reimplemented in
QPrinter but super class margins were not set in reimplemented method.

This fixes problem where QTextDocument::print() checked the margins
using QPagedPaintDevice::margins() and overrided the margins set
in QPrinter::setMargins().

Change-Id: I3bdcc33b8f6b5a9cbcb04a21484fdd1612dd7d58
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
src/printsupport/kernel/qprinter.cpp

index 06b1215..2b4f101 100644 (file)
@@ -1584,6 +1584,9 @@ void QPrinter::setMargins(const Margins &m)
 {
     Q_D(QPrinter);
 
+    // set margins also to super class
+    QPagedPaintDevice::setMargins(m);
+
     const qreal multiplier = 72./25.4;
     QList<QVariant> margins;
     margins << (m.left * multiplier) << (m.top * multiplier)