Commit 3a48dd18 authored by Martin Koller's avatar Martin Koller
Browse files

Fix centered printout in landscape mode

BUG: 362359
parent 82835e0f
...@@ -1346,29 +1346,21 @@ void kpMainWindow::sendImageToPrinter (QPrinter *printer, ...@@ -1346,29 +1346,21 @@ void kpMainWindow::sendImageToPrinter (QPrinter *printer,
} }
// Send image to printer.
QPainter painter;
painter.begin(printer);
double originX = 0, originY = 0; double originX = 0, originY = 0;
// Center image on page? // Center image on page?
if (d->configPrintImageCenteredOnPage) if (d->configPrintImageCenteredOnPage)
{ {
originX = originX = (printer->width() - image.width ()) / 2;
(printerWidthMM * dpiX / KP_MILLIMETERS_PER_INCH - image.width ()) originY = (printer->height() - image.height ()) / 2;
/ 2;
originY =
(printerHeightMM * dpiY / KP_MILLIMETERS_PER_INCH - image.height ())
/ 2;
} }
#if DEBUG_KP_MAIN_WINDOW painter.drawImage(qRound(originX), qRound(originY), image);
kDebug () << "\torigin: x=" << originX << " y=" << originY; painter.end();
#endif
// Send image to printer.
QPainter painter;
painter.begin (printer);
painter.drawImage (qRound (originX), qRound (originY), image);
painter.end ();
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment