From 7494751becfadf0a87d2fa965cb97b78eec2fb1b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Mar 2022 13:58:01 +0100 Subject: [PATCH] Pdf export : Remove theme change before export to PDF Crash seen on Windows related to theme change as part of export to PDF. This is related to export of plots to PDF in dark mode. Investigate other solution. --- .../RicSnapshotViewToFileFeature.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index 63bd9e1d94..27bc56b0fb 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -29,7 +29,6 @@ #include "RimViewWindow.h" #include "RiuFileDialogTools.h" -#include "RiuGuiTheme.h" #include "RiuPlotMainWindow.h" #include "RicSnapshotFilenameGenerator.h" @@ -91,17 +90,6 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, auto viewWidget = plot->viewWidget(); - // For some reason, the application crashes (seen on Windows 11) if the theme is changed when a plot window is - // maximized. Make sure the MDI windows are displayed as normal, and restore the maximized state - bool maximizedState = viewWidget->isMaximized(); - if ( maximizedState ) viewWidget->showNormal(); - - auto currentTheme = RiuGuiTheme::currentGuiTheme(); - if ( currentTheme != RiaDefines::ThemeEnum::LIGHT ) - { - RiuGuiTheme::updateGuiTheme( RiaDefines::ThemeEnum::LIGHT ); - } - RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots(); QCoreApplication::processEvents(); QFile pdfFile( fileName ); @@ -148,13 +136,6 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, { RiaLogging::error( QString( "Could not write PDF to %1" ).arg( fileName ) ); } - - if ( currentTheme != RiaDefines::ThemeEnum::LIGHT ) - { - RiuGuiTheme::updateGuiTheme( currentTheme ); - } - - if ( maximizedState ) viewWidget->showMaximized(); } //--------------------------------------------------------------------------------------------------