Bug 479861

Summary: Drop event runs when it should not
Product: [Plasma] kwin Reporter: Javier O. Cordero Pérez (Cuperino) <javiercorderoperez>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: agurenko, fanzhuyifan, kde, nate, vlad.zahorodnii, xaver.hugl
Priority: NOR Keywords: qt6
Version First Reported In: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Javier O. Cordero Pérez (Cuperino) 2024-01-15 18:56:47 UTC
SUMMARY
***
Dropping to a list when `canDropMimeData` returns _false_ results in `dropMimeData` being executed, when in normal circumstances it would only be run if canDropMimeData returned _true_.
***

PRE-REQUIREMENTS
1. Have a Qt Widgets app that displays a tree view.
2. The tree view's items must accept drops, and have drag enabled for convenience.
2. Use a model that inherits from `QAbstractItemModel` and implements `canDropMimeData` and `dropMimeData`.
3. The model should contain two or more items.
4. Despite the tree view being able to accept drops, the model must return _false_ for `canDropData`.

STEPS TO REPRODUCE
1. Drag one item from the list onto another item from the list.
or
1. Alternatively, drag a file from Dolphin into the list.

OBSERVED RESULT
On a Plasma (Wayland) session:
* `dropMimeData` is run after the item is dropped
On a Plasma (X11) session:
* `dropMimeData` is not run after the item is dropped

EXPECTED RESULT
In either session:
* `dropMimeData` is not run after the item is dropped

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 39, Linux 6.6.9-200.fc39.x86_64 (64 bits)
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 5.249.0
Qt Version: 6.6.0
Graphics Platform: Wayland

ADDITIONAL INFORMATION
I thought this might be a bug in Qt, but it doesn't happen when running the same Qt app inside a Gnome (Wayland) session, it only affects Plasma (Wayland), hence why I'm reporting it here.
Comment 1 David Edmundson 2024-01-17 15:33:06 UTC
It implies you have an example app with this happening? Could you attach it please
Comment 2 fanzhuyifan 2024-02-13 04:46:25 UTC
Waiting for example demo app
Comment 3 Bug Janitor Service 2024-02-28 03:46:33 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2024-03-14 03:47:00 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!