mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 07:16:53 -06:00
#1379 Get active view window before displaying file selection dialog
This commit is contained in:
parent
380de17ae0
commit
6b78d98a74
@ -19,6 +19,7 @@
|
||||
#include "RicSnapshotViewToClipboardFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
@ -119,6 +120,17 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* proj = app->project();
|
||||
|
||||
// Get active view window before displaying the file selection dialog
|
||||
// If this is done after the file save dialog is displayed (and closed)
|
||||
// app->activeViewWindow() returns NULL on Linux
|
||||
RimViewWindow* viewWindow = app->activeViewWindow();
|
||||
if (!viewWindow)
|
||||
{
|
||||
RiaLogging::error("No view window is available, nothing to do");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
QString startPath;
|
||||
if (!proj->fileName().isEmpty())
|
||||
{
|
||||
@ -141,7 +153,6 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
|
||||
// Remember the directory to next time
|
||||
app->setLastUsedDialogDirectory("IMAGE_SNAPSHOT", QFileInfo(fileName).absolutePath());
|
||||
|
||||
RimViewWindow* viewWindow = app->activeViewWindow();
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(fileName, viewWindow);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user