Skip to content

Conversation

@Wing-summer
Copy link

@Wing-summer Wing-summer commented Nov 16, 2025

Hello, I fix the drag drop problem on wayland. Here is the screenshot before applying this patch:

屏幕截图_20251116_151707

Due to wayland limitation, frameless window can not reposition by programing. That's why will break up dragging and droping dock widget. I open debugging console on wayland and the screenshot as following:

屏幕截图_20251116_155408

As we can see from the image, we create many dialogs and set these frameless so QWidget::move not work on wayland.

While Qt::Tool equals Qt::Popup | Qt::Dialog, Qt::ToolTip is same as Qt::Popup | Qt::Sheet. Qt::Sheet is used for MacOS. I changed Qt::Tool | Qt::FramelessWindowHint to Qt::ToolTip and drag-and-drop works very well:

屏幕截图_20251116_150750

So, why? I dive into wayland protocol and found the reason.

When set Qt::ToolTip atrribute to a widget. Qt will create a XdgPopupWindow object:

屏幕截图_20251116_160625

According to protocol, xdg_popup have the ability to reposition. So we can use the Qt::ToolTip atrribute to solve the problem.

However, floating window is still broken on wayland. It will crash the APP surface:

image

Also, it works well on Linux X11 (no change on Windows), tested with Qt6.10. This may a good solution for wayland native who don't need floating windows.

@pylessard
Copy link

that is awesome! My app forces X11 on boot because of that issue

@cristianadam
Copy link

cristianadam commented Nov 18, 2025

Good catch with Qt::ToolTip. At https://codereview.qt-project.org/c/qt-creator/qt-creator/+/691950 I have some code to enable floating widgets.

See qt-creator-ads-wayland.mp4 showcasing that it works. This resulted from the information at #714 where we have a link to Use platform drags for drags of docks and toolbars on wayland

It only works when dragging a tab and letting it go, then you can drag it again.

If you double click, the drag information is missing and can't bring it back.

Also the overlay buttons don't react to the drop, they would have to accept this too.

@Wing-summer
Copy link
Author

Good catch with Qt::ToolTip. At https://codereview.qt-project.org/c/qt-creator/qt-creator/+/691950 I have some code to enable floating widgets.

See qt-creator-ads-wayland.mp4 showcasing that it works. This resulted from the information at #714 where we have a link to Use platform drags for drags of docks and toolbars on wayland

It only works when dragging a tab and letting it go, then you can drag it again.

If you double click, the drag information is missing and can't bring it back.

Also the overlay buttons don't react to the drop, they would have to accept this too.

Thanks for informing me. It looks fantastic. The only imperfection is that we can not drag the part of overlay with Qt::Tooltip out of the screen, unlike the normal overlay window. I have no idea whether is Qt implements or wayland limitation. I have a brief glance on source code about QWidget. It's complex for me to figure out.

This is not a critical issue with double clicking undock. We can disable this feature on wayland automatically and talk to the developer in the document.

Would you like to give a PR with a full patch to this repo? I will close it if you do.

@cristianadam
Copy link

Good catch with Qt::ToolTip. At https://codereview.qt-project.org/c/qt-creator/qt-creator/+/691950 I have some code to enable floating widgets.
See qt-creator-ads-wayland.mp4 showcasing that it works. This resulted from the information at #714 where we have a link to Use platform drags for drags of docks and toolbars on wayland
It only works when dragging a tab and letting it go, then you can drag it again.
If you double click, the drag information is missing and can't bring it back.
Also the overlay buttons don't react to the drop, they would have to accept this too.

Thanks for informing me. It looks fantastic. The only imperfection is that we can not drag the part of overlay with Qt::Tooltip out of the screen, unlike the normal overlay window. I have no idea whether is Qt implements or wayland limitation. I have a brief glance on source code about QWidget. It's complex for me to figure out.

This is not a critical issue with double clicking undock. We can disable this feature on wayland automatically and talk to the developer in the document.

Would you like to give a PR with a full patch to this repo? I will close it if you do.

Feel free to implement the same feature in this PR or a subsequent PR.

Qt Creator has a fork of ADS, and the fork works as seen in the screencast. I have tried the same thing with upstream ADS and didn't work in the same way. The floating window disappeared while trying to move it.

@Wing-summer
Copy link
Author

Good catch with Qt::ToolTip. At https://codereview.qt-project.org/c/qt-creator/qt-creator/+/691950 I have some code to enable floating widgets.
See qt-creator-ads-wayland.mp4 showcasing that it works. This resulted from the information at #714 where we have a link to Use platform drags for drags of docks and toolbars on wayland
It only works when dragging a tab and letting it go, then you can drag it again.
If you double click, the drag information is missing and can't bring it back.
Also the overlay buttons don't react to the drop, they would have to accept this too.

Thanks for informing me. It looks fantastic. The only imperfection is that we can not drag the part of overlay with Qt::Tooltip out of the screen, unlike the normal overlay window. I have no idea whether is Qt implements or wayland limitation. I have a brief glance on source code about QWidget. It's complex for me to figure out.
This is not a critical issue with double clicking undock. We can disable this feature on wayland automatically and talk to the developer in the document.
Would you like to give a PR with a full patch to this repo? I will close it if you do.

Feel free to implement the same feature in this PR or a subsequent PR.

Qt Creator has a fork of ADS, and the fork works as seen in the screencast. I have tried the same thing with upstream ADS and didn't work in the same way. The floating window disappeared while trying to move it.

OK. I merge your changes and test the codes. Floating window can create successfully. But I move the floating window, the dock overlay cannot work properly and I have no idea about it. Can you give me some tips?

The reason why floating window disappeared is that QtAds try to set Qt::WindowStaysOnTopHint on it. Here are some comments on DockManager.cpp:

setWindowFlags(Qt::WindowStaysOnTopHint) will hide the window and thus requires a show call. This then leads to flickering and a nasty endless loop (also buggy behaviour on Ubuntu. So we just do it ourself.

Yes, same the problem on Wayland too. Just remove all else branch about Qt::WindowStaysOnTopHint flag setting and works fine.

@nixigaj
Copy link

nixigaj commented Dec 3, 2025

Just mentioning that the PR code uses spaces for indentation when it should use tabs for indentation, like the rest of the codebase.

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

Successfully merging this pull request may close these issues.

4 participants