diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-09-03 18:42:30 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-09-04 08:37:59 +0200 |
commit | 00a5629d8de18bc1a5dfb6e2526c03b4b021c903 (patch) | |
tree | d444ede3eb66e5455e09c4de3fda32bcd7437a4a /examples | |
parent | 6b171dc6c0c0f0a822b212df77b58b28bd92716c (diff) |
Remove deprecated QPrinter and QPagedPaintDevice APIs
Adjusting the QPrinter test case - some use cases no longer exist, or are
already tested in QPageSize and QPageLayout tests.
Adjust examples and manual tests.
Change-Id: I01cbc65f3d8031aea2dac86dd942126ba708b111
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/widgets/itemviews/pixelator/mainwindow.cpp | 8 | ||||
-rw-r--r-- | examples/widgets/painting/fontsampler/mainwindow.cpp | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/widgets/itemviews/pixelator/mainwindow.cpp b/examples/widgets/itemviews/pixelator/mainwindow.cpp index e590a1397b..591123b187 100644 --- a/examples/widgets/itemviews/pixelator/mainwindow.cpp +++ b/examples/widgets/itemviews/pixelator/mainwindow.cpp @@ -197,12 +197,12 @@ void MainWindow::printImage() painter.save(); - double xscale = printer.pageRect().width() / double(sourceWidth); - double yscale = printer.pageRect().height() / double(sourceHeight); + double xscale = printer.pageRect(QPrinter::DevicePixel).width() / double(sourceWidth); + double yscale = printer.pageRect(QPrinter::DevicePixel).height() / double(sourceHeight); double scale = qMin(xscale, yscale); - painter.translate(printer.paperRect().x() + printer.pageRect().width() / 2, - printer.paperRect().y() + printer.pageRect().height() / 2); + painter.translate(printer.paperRect(QPrinter::DevicePixel).x() + printer.pageRect(QPrinter::DevicePixel).width() / 2, + printer.paperRect(QPrinter::DevicePixel).y() + printer.pageRect(QPrinter::DevicePixel).height() / 2); painter.scale(scale, scale); painter.translate(-sourceWidth / 2, -sourceHeight / 2); diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp index 96258a66d0..65a186099d 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.cpp +++ b/examples/widgets/painting/fontsampler/mainwindow.cpp @@ -320,16 +320,16 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer) } } - qreal xScale = printer->pageRect().width() / width; - qreal yScale = printer->pageRect().height() / height; + qreal xScale = printer->pageRect(QPrinter::DevicePixel).width() / width; + qreal yScale = printer->pageRect(QPrinter::DevicePixel).height() / height; qreal scale = qMin(xScale, yScale); - qreal remainingHeight = printer->pageRect().height()/scale - height; + qreal remainingHeight = printer->pageRect(QPrinter::DevicePixel).height()/scale - height; qreal spaceHeight = (remainingHeight / 4.0) / (items.count() + 1); qreal interLineHeight = (remainingHeight / 4.0) / (sampleSizes.count() * items.count()); painter->save(); - painter->translate(printer->pageRect().width() / 2.0, printer->pageRect().height() / 2.0); + painter->translate(printer->pageRect(QPrinter::DevicePixel).width() / 2.0, printer->pageRect(QPrinter::DevicePixel).height() / 2.0); painter->scale(scale, scale); painter->setBrush(QBrush(Qt::black)); |