Much improved legend rendering

This commit is contained in:
Gaute Lindkvist
2020-01-07 09:26:39 +01:00
parent 185b26514b
commit 7bd62052ca
10 changed files with 100 additions and 108 deletions

View File

@@ -85,22 +85,21 @@ void RicSnapshotViewToFileFeature::savePlotPDFReportAs( const QString& fileName,
QFile pdfFile( fileName );
if ( pdfFile.open( QIODevice::WriteOnly ) )
{
int resolution = RiaGuiApplication::applicationResolution();
/* int pageWidth = plot->pageLayout().fullRectPixels( resolution ).width();
int widgetWidth = plot->viewWidget()->width();
int deltaWidth = widgetWidth - pageWidth;
int resolution = RiaGuiApplication::applicationResolution();
int pageWidth = plot->pageLayout().fullRectPixels( resolution ).width();
int widgetWidth = plot->viewWidget()->width();
int deltaWidth = widgetWidth - pageWidth;
while ( std::abs( deltaWidth ) > 1 )
{
int newResolution = resolution + deltaWidth / std::abs( deltaWidth );
pageWidth = plot->pageLayout().fullRectPixels( resolution ).width();
int newDeltaWidth = widgetWidth - pageWidth;
if ( std::abs( newDeltaWidth ) > std::abs( deltaWidth ) ) break;
while ( std::abs( deltaWidth ) > 1 )
{
int newResolution = resolution + deltaWidth / std::abs( deltaWidth );
pageWidth = plot->pageLayout().fullRectPixels( resolution ).width();
int newDeltaWidth = widgetWidth - pageWidth;
if ( std::abs( newDeltaWidth ) > std::abs( deltaWidth ) ) break;
resolution = newResolution;
deltaWidth = newDeltaWidth;
}
*/
resolution = newResolution;
deltaWidth = newDeltaWidth;
}
QPdfWriter pdfPrinter( fileName );
pdfPrinter.setPageLayout( plot->pageLayout() );
pdfPrinter.setCreator( QCoreApplication::applicationName() );