Is external drag and drop broken in Qt 5.7.0 on Windows 8.1?
I have recently upgraded my application from 5.5 to 5.7 (for VS2015) and, after a while, noticed that dropping files from Windows explorer stopped working. I am quite sure that I did not change anything related for a long time in these specific parts of my application. I have setAcceptDrops(true) calls on all necessary widgets, and it looks like dragEnterEvent simply never arrives now.
I have also just tried compiling the dropsite sample from my Qt distribution, and guess what - it doesn't work either!
In-application drag&drop functionality (like draggableicons sample) is still working fine, though.
So.... what happened?
Hi and welcome to devnet,
You may have found a regression. Can you check whether it's also the case with the latest 5.6 ? It'll help pinpoint when it started to happen.
In any case, you should take a look at the bug report system to see if it's something known. If not please consider opening a new report after having tested with 5.6
Ok, this took a while to find out, but now it looks like the problem may not be with Qt itself after all (or maybe it is, but in a different way). Dropping files only does not work when the application is launched directly from under Visual Studio (2015 or 2013 - haven't tried downgrading to 2010 yet). However, it does work when exe is launched "freely".
I guess I didn't test this feature for quite a while from under the IDE. :( Happens when you develop something big all alone on your spare time... Had to try 5 different versions of Qt down to 5.5.0 (for which I happen to have an old working build to test) before I realized what's the difference.
Now I'm confused and not sure where to look next to find the original root cause. :) But thanks anyway.
Turns out the cause is that Visual Studio runs elevated, and drag & drop is blocked by default between elevated and non-elevated apps. Funny, this is even older than I thought:
Although the solution published there does not work for me with Qt (probably there are some more messages), but at least I can confirm that it's elevation that causes it (tried running "free" executable as admin).
So, sorry for the false alarm. :)
Glad you found out and thanks for sharing !
No need to be sorry, it's something that other people might hit some days and this thread will help them :)