Thursday, January 30, 2014

Qt's Drag-and-Drop Architecture for Python and PyQt5 Index page

I have written an extensive review of how Qt's Drag-and-Drop architecture is used in Python and PyQt5. Here are links to the parts of the saga in proper sequence:

3 comments:

Unknown said...

Hi!

I have found your Qt Forums post, where you were asking when the targetChanged signal is emitted.

https://forum.qt.io/topic/36997/answered-when-is-the-signal-qdrag-targetchanged-emitted/3

Have you found the answer? Is it when cursor enters a new Drag Target, or when the Drop is allowed and performed?

David Cortesi said...

Everything I learned, I put in the posts indexed from this page. In the end I did not implement the feature that I wanted. I had hoped to implement a tab bar and be able to drag a tab out of it and have it convert to an independent window -- just like with a modern browser. I could not figure out how to do that, and it was not necessary after all.

So these posts are all I every learned. Good luck.

Unknown said...

Ah, ok then.

My findings regarding the targetChanged signal for anyone who wonders in here:
(a) If drag cursor dragEnterEvent()s a Widget and it acceptProposedAction()s, targetChanged(Widget) is emitted.
(b) If the Widget ignore()s dragEnterEvent, targetChanged(nullptr) is emitted and it is not emitted anymore unless (a) happens again.

What you wanted to do would be possible if you connected a function to the targetChanged signal and created an independent window (i. e. setParent(nullptr) and show()) whenever the target changed from the Tab Bar.