Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Floating QDockWidget appears not on the same screen as the main window when dragged

Floating QDockWidget appears not on the same screen as the main window when dragged

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdockwidgetmulti-screenqt6
4 Posts 3 Posters 607 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bibasmall
    wrote on 14 Feb 2023, 15:59 last edited by bibasmall
    #1

    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?
    1fbfae71-ad52-46b8-8f6b-4da81c8f6d01-image.png

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 Feb 2023, 19:49 last edited by
      #2

      Hi,

      You should add which version of Qt you are using as well as the OS which looks like Windows.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply 15 Feb 2023, 07:28
      0
      • S SGaist
        14 Feb 2023, 19:49

        Hi,

        You should add which version of Qt you are using as well as the OS which looks like Windows.

        B Offline
        B Offline
        bibasmall
        wrote on 15 Feb 2023, 07:28 last edited by
        #3

        @SGaist

        Hello,
        my bad. I'm using Qt 6.3.2 on windows 10 and msvc.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          laura_pons
          wrote on 12 Jun 2024, 07:10 last edited by
          #4

          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

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved