[Development] QPushButton: drag and drop

Laszlo Papp lpapp at kde.org
Fri Jun 3 14:20:31 CEST 2022


Hi,

It seems that QWidget::mouseReleaseEvent does not get triggered after
QDrag::exec. This causes the following issue that the QPushButton instance
gets stuck in "pressed down" (with pressed highlight, etc) state as the
following short gif shows: https://imgur.com/a/dk7zs9D

I worked this around by calling setDown(false); after drag->exec(...), but
I wonder if this is something that should be, or even can be fixed in Qt
for all OSes.

Here is a small testbed example I have put together that is really small
and reproduces the issue. This is what I also used for the above gif to
show the issue.

https://github.com/lpapp/examples/tree/main/qt-button-dnd

This is where the QDragManager::drag starts grabbing the mouse on Linux
with X11 for example:
https://github.com/openwebos/qt/blob/master/src/gui/kernel/qdnd_x11.cpp#L2026

I do not know the details very well, but from a user point of view, it
would be good to either let mouseReleaseEvent get triggered as usual after
the dragging has finished or at least not to have artifacts like the above
around.

I have also noticed several posts on Stack Overflow, Qt Centre, etc, about
this issue without a "real solution". E.g. this dates back to 12 years ago:
https://www.qtcentre.org/threads/34539-Drag-and-drop-from-QPushButton

What do you think about this issue?

Thanks.

Kind regards,
László
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220603/71fefce4/attachment.htm>


More information about the Development mailing list