Preserve dock parents to avoid black QOpenGLWidget views - #871
Open
kriben wants to merge 1 commit into
Open
Conversation
Switching dock tabs reparents inactive non-native widgets to nullptr, temporarily turning them into top-level windows. For QOpenGLWidget children, these transitions can invalidate Qt composition resources even when shared OpenGL contexts remain alive, leading to black frames or views that recover only after another repaint. The internalWinId() condition restricted parent preservation to dock widgets with an existing native window handle. A non-native dock can also contain a QOpenGLWidget, which normally renders into an offscreen framebuffer that Qt composites into the containing window. Such docks need protection from temporary top-level transitions too, so native-window status is not an appropriate condition for preserving their parent. Remove the internalWinId() condition and keep detached widgets parented to the dock manager regardless of whether they are native. This neither creates nor removes native window handles. Explicitly hide detached widgets before reparenting because setParent() may be a no-op. Retain the null-parent fallback when no dock manager is available and update the layout ownership documentation. This avoids forcing native windows or adding extra repaint requests. No application-specific environment variable is required. Related ResInsight issue: OPM/ResInsight#14708
Author
|
Tested on Windows 11, Ubuntu 26.04 (Wayland) and Redhat 8 (X11): seems to solve the problem everywhere. |
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.
Switching dock tabs reparents inactive non-native widgets to nullptr, temporarily turning them into top-level windows. For QOpenGLWidget children, these transitions can invalidate Qt composition resources even when shared OpenGL contexts remain alive, leading to black frames or views that recover only after another repaint.
The internalWinId() condition restricted parent preservation to dock widgets with an existing native window handle. A non-native dock can also contain a QOpenGLWidget, which normally renders into an offscreen framebuffer that Qt composites into the containing window. Such docks need protection from temporary top-level transitions too, so native-window status is not an appropriate condition for preserving their parent.
Remove the internalWinId() condition and keep detached widgets parented to the dock manager regardless of whether they are native. This neither creates nor removes native window handles. Explicitly hide detached widgets before reparenting because setParent() may be a no-op. Retain the null-parent fallback when no dock manager is available and update the layout ownership documentation.
This avoids forcing native windows or adding extra repaint requests. No application-specific environment variable is required.
Related ResInsight issue: OPM/ResInsight#14708