Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addDockWidgetToContainingWindow should use the mainWindow() function to work in a non-toplevel main window #386

Closed
AndreMeyerRMC opened this issue Aug 14, 2023 · 1 comment
Assignees
Milestone

Comments

@AndreMeyerRMC
Copy link

As stated in the DockWidgetBase::mainWindow - function, The Docking system should work with QMainWindows that are children of other windows. In addDockWidgetToContainingWindow that is not recognised.

diff:

Index: src/DockWidgetBase.cpp
===================================================================
--- src/DockWidgetBase.cpp
+++ src/DockWidgetBase.cpp
@@ -118,7 +118,7 @@
                                                      DockWidgetBase *relativeTo,
                                                      InitialOption initialOption)
 {
-    if (auto mainWindow = qobject_cast<MainWindowBase *>(window())) {
+    if (auto mainWindow = DockWidgetBase::mainWindow()) {
         // It's inside a main window. Simply use the main window API.
         mainWindow->addDockWidget(other, location, relativeTo, initialOption);
         return;
iamsergio added a commit that referenced this issue Apr 1, 2024
iamsergio added a commit that referenced this issue Apr 1, 2024
It needs to be added to the direct parent, not to the top-level
main window.

Fixes issue #386
@iamsergio iamsergio self-assigned this Apr 1, 2024
@iamsergio iamsergio added this to the v2.1 milestone Apr 1, 2024
@iamsergio
Copy link
Contributor

Fixed for 2.1 and added a unit-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants