0

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 make the dock widget appear on the screen where the main window is, when it's detached by dragging?

How does it look

Bibasmall
  • 33
  • 4

0 Answers0