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

@@ -284,9 +284,9 @@ void RiuMultiPlotWindow::scheduleReplotOfAllPlots()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotWindow::renderTo( QPainter* painter )
void RiuMultiPlotWindow::renderTo( QPaintDevice* paintDevice )
{
doRenderTo( painter );
doRenderTo( paintDevice );
}
//--------------------------------------------------------------------------------------------------
@@ -789,22 +789,23 @@ std::pair<int, int>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotWindow::doRenderTo( QPainter* painter )
void RiuMultiPlotWindow::doRenderTo( QPaintDevice* paintDevice )
{
QPainter painter( paintDevice );
setSelectionsVisible( false );
m_plotTitle->render( painter );
m_plotTitle->render( &painter );
for ( auto subTitle : subTitlesForVisiblePlots() )
{
if ( subTitle->isVisible() )
{
subTitle->render( painter, m_plotWidgetFrame->mapToParent( subTitle->frameGeometry().topLeft() ) );
subTitle->render( &painter, m_plotWidgetFrame->mapToParent( subTitle->frameGeometry().topLeft() ) );
}
}
for ( auto legend : legendsForVisiblePlots() )
{
legend->render( painter, m_plotWidgetFrame->mapToParent( legend->frameGeometry().topLeft() ) );
legend->render( &painter, m_plotWidgetFrame->mapToParent( legend->frameGeometry().topLeft() ) );
}
for ( auto plotWidget : visiblePlotWidgets() )
@@ -814,7 +815,7 @@ void RiuMultiPlotWindow::doRenderTo( QPainter* painter )
QPoint plotWidgetFrameTopLeft = m_plotWidgetFrame->frameGeometry().topLeft();
plotWidgetGeometry.moveTo( plotWidgetTopLeft + plotWidgetFrameTopLeft );
plotWidget->renderTo( painter, plotWidgetGeometry );
plotWidget->renderTo( &painter, plotWidgetGeometry );
}
setSelectionsVisible( true );