Fixes handling of native / alien widgets when (un)docking#820
Open
RubendeBruin wants to merge 4 commits intogithubuser0xFFFF:masterfrom
Open
Fixes handling of native / alien widgets when (un)docking#820RubendeBruin wants to merge 4 commits intogithubuser0xFFFF:masterfrom
RubendeBruin wants to merge 4 commits intogithubuser0xFFFF:masterfrom
Conversation
When a content widget (e.g. VTK/OpenGL) calls winId() to get a native window handle, Qt propagates native-window creation up the ancestor chain. This makes CDockWidget, CDockAreaWidget, and CDockContainerWidget all become native OS windows unexpectedly. Reparenting these native dock widgets during floating or resizing then causes drawing artifacts. Fix: set Qt::WA_DontCreateNativeAncestors on the content widget in CDockWidget::setWidget() to stop native-window creation from propagating up into the dock hierarchy. Co-authored-by: RubendeBruin <34062862+RubendeBruin@users.noreply.github.com>
Three targeted fixes for the native/alien widget mixing problem: 1. Revert WA_DontCreateNativeAncestors from CDockWidget::setWidget(). Setting it on the content widget created a broken native-inside-alien hierarchy: the QScrollArea (alien) could not clip its native child, so content escaped the scrollbox bounds; and alien CAutoHideDockContainer could not appear above the native content widget. Allowing natural propagation means QScrollArea also goes native, and OS parent/child window clipping works correctly. 2. Fix CDockContainerWidget::removeDockArea to use internalWinId() instead of testAttribute(WA_NativeWindow). WA_NativeWindow is only set when a widget is explicitly made native; widgets that became native through upward propagation from a descendant calling winId() have a real native window handle (internalWinId() != 0) but WA_NativeWindow may be unset. Setting their parent to nullptr would create a free-floating invisible OS window and cause drawing artifacts. 3. Fix CAutoHideDockContainer::collapseView: when the parent dock container is native but the auto-hide panel is still alien, promote the panel to a native window (winId()) before raise(). The OS always renders native child windows above a parent window's painted alien content, so an alien auto-hide panel can never appear above native sibling dock areas. Once the panel has its own OS-level window, raise() operates on OS Z-order and correctly places it above native content siblings. Co-authored-by: RubendeBruin <34062862+RubendeBruin@users.noreply.github.com>
…rors Fix docking system to handle mix of native and alien Qt widgets
Author
|
these changes fix issue #819 |
Author
|
@githubuser0xFFFF, Ready for review. Let me know if you want me to squash the commits, although I believe github can do that automatically when merging. These two changes fix all the drawing issues that I'm having with my application. |
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.
These two changes fix the artifacts for this situation.