Change from QPainter to QPaintDevice in the API for PDF rendering

* This is to be able to use QPagedPaintDevice::nextPage in the Multi plot rendering.
This commit is contained in:
Gaute Lindkvist
2019-12-19 10:34:23 +01:00
parent 65f4a5e089
commit 27788b1abd
13 changed files with 46 additions and 33 deletions

View File

@@ -40,7 +40,6 @@
#include <QFileInfo>
#include <QMdiSubWindow>
#include <QPageLayout>
#include <QPainter>
#include <QPdfWriter>
CAF_CMD_SOURCE_INIT( RicSnapshotViewToFileFeature, "RicSnapshotViewToFileFeature" );
@@ -90,12 +89,11 @@ void RicSnapshotViewToFileFeature::savePlotPDFReportAs( const QString& fileName,
pdfPrinter.setPageLayout( plot->pageLayout() );
pdfPrinter.setCreator( QCoreApplication::applicationName() );
pdfPrinter.setResolution( resolution );
QPainter painter( &pdfPrinter );
QRect widgetRect = plot->viewWidget()->contentsRect();
QRect fullPageRect = pdfPrinter.pageLayout().fullRectPixels( resolution );
QRect paintRect = pdfPrinter.pageLayout().paintRectPixels( resolution );
QRect widgetRect = plot->viewWidget()->contentsRect();
QRect fullPageRect = pdfPrinter.pageLayout().fullRectPixels( resolution );
QRect paintRect = pdfPrinter.pageLayout().paintRectPixels( resolution );
plot->viewWidget()->resize( paintRect.size() );
plot->renderWindowContent( &painter );
plot->renderWindowContent( &pdfPrinter );
plot->viewWidget()->resize( widgetRect.size() );
}
else