#5288 Fix update issues

This commit is contained in:
Gaute Lindkvist
2020-01-06 12:43:33 +01:00
parent 0692ea28ad
commit a0cac2fefa
9 changed files with 81 additions and 36 deletions

View File

@@ -84,22 +84,22 @@ 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;
resolution = newResolution;
deltaWidth = newDeltaWidth;
}
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;
}
*/
QPdfWriter pdfPrinter( fileName );
pdfPrinter.setPageLayout( plot->pageLayout() );
pdfPrinter.setCreator( QCoreApplication::applicationName() );