#14511 Activate 3D view after importing grid model from summary case - #14604
Open
magnesj wants to merge 1 commit into
Open
#14511 Activate 3D view after importing grid model from summary case#14604magnesj wants to merge 1 commit into
magnesj wants to merge 1 commit into
Conversation
The import path in openOrImportGridModelFromSummaryCase() returned right after opening the Eclipse case, leaving the newly created 3D view in the background while focus stayed on the summary plot window. Extract the activation into a shared activateFirstView() helper, and use processEvents() followed by activateWindow() to raise the 3D window on top of the plot window, matching the pattern already used in RiaImportEclipseCaseTools::openEclipseFilesFromFileNames().
kriben
requested changes
Aug 26, 2026
kriben
left a comment
Collaborator
There was a problem hiding this comment.
Not a big fan of QApplication::processEvents(). Official docs says use is discouraged: https://doc.qt.io/qt-6/qcoreapplication.html#processEvents
Comment on lines
+281
to
+288
| if ( RiaGuiApplication::isRunning() && RiuMainWindow::instance() ) | ||
| { | ||
| // Call process events to clear the queue. This makes sure that we are able to raise the 3D window on top of the | ||
| // plot window. Otherwise the event processing ends up with the plot window on top. | ||
| QApplication::processEvents(); | ||
| RiuMainWindow::instance()->activateWindow(); | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
QApplication::processEvents() introduces a nested event loop and can execute unrelated UI actions, including closing/deleting the main window, before the following activateWindow() call.
Prefer deferred activation:
auto* mainWindow = RiuMainWindow::instance();
if ( RiaGuiApplication::isRunning() && mainWindow )
{
QTimer::singleShot( 0,
mainWindow,
[mainWindow]()
{
mainWindow->raise();
mainWindow->activateWindow();
} );
} Using mainWindow as the timer context cancels the callback if it is destroyed. It also lets pending show/window events finish without reentrant processing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14511
When importing a grid model from a Summary Case (or from an individual realization of an Ensemble Summary Case), the 3D view was created but stayed in the background — focus remained on the summary plot window.
RimReloadCaseTools::openOrImportGridModelFromSummaryCase()had two paths. The "grid already imported" path activated the first view, but the "import from file" path returned right afteropenEclipseCaseFromFile()without activating anything. In addition,RicShowMainWindowFeature::showMainWindow()only doesshow()/raise(), which is not enough to get the 3D window in front of the plot window.Changes:
QApplication::processEvents()followed byRiuMainWindow::activateWindow(), the same pattern already used inRiaImportEclipseCaseTools::openEclipseFilesFromFileNames().