Floating QDockWidget appears not on the same screen as the main window when dragged
-
Hello everyone!
I'm completely stuck with the following problem. When I drag a dock widget out of the main window, which is placed on the second screen, the floating dock appears on the first screen. When I click on the float button, it appears undocked correctly, i.e. near the main window, but only if I didn't drag it out before. If I did, docked it after and then clicked the float button, it appears detached on the first screen as well.
When I do all this on the first screen, it works fine.First I thought I could force the dock widget to appear where I want it to by using something like this:
connect(dock, &QDockWidget::topLevelChanged, [this, dock](bool) { dock->setGeometry(this->x(), this->y(), 200, 500); });
It solved buggy floating button behavior, but didn't help with dragging, so my dock widget appears 200x500 px on the first screen again.
I also don't see any possibility to subclass and override anything here.
Is there a way to force the dock widget appear on the screen where the main window is, when it's detached by dragging? Or maybe to set the current screen as primary for the main window?
-
Hi,
You should add which version of Qt you are using as well as the OS which looks like Windows.
-
In case someone is still facing this, it is a known bug on 6.3.2 fixed on 6.4.0: https://bugreports.qt.io/browse/QTBUG-106064