Why does drag and drop in Qt stop working?

in our software in qt 4.8.5, in some cases drag and drop stop working. There are two places where he needs to work. One when dragging the file to a specific location in the application and a second to the QTreeWidget where you can put some sheets in folders.

But on some machines (Windows) both methods just stop working or don't work from the start. Then only the forbidden cursor appears. After restarting the app, drag and drop works again. It doesn't seem to be a problem with different privileges on Windows.

I don't know where to look for this problem. Any advice is appreciated.

+3


source to share


1 answer


After days of searching the internet, I could find the cause of the problem.

https://bugreports.qt-project.org/browse/qtbug-28601

In our software, you can switch the size of the module that the setWindowFlags call uses. After that, no more drag events are processed.



I could solve this problem by calling:

setAttribute( Qt::WA_AcceptDrops, false );
setAttribute( Qt::WA_AcceptDrops, true );

      

in widgets that require dragging. Hopefully we will update Qt 5.x soon.:/

+1


source







All Articles