PDA

View Full Version : Cannot Drop on QGraphicsView



Seishin
5th June 2013, 19:42
I want to drag a QTreeWidgetItem and drop the mime data onto a customized QGraphicsView in a customized QWidget.
The drag looks working fine because when I drag the item and drop onto the Qt Drop Site example, the mime data is read correctly.

I have implemented the dragMoveEvent() and dragEnterEvent() of the QGraphicsView to accept drops, and setAcceptDrops() to true.
However, when I drag the item onto the view, the mouse icon is a big "unavailable" and the dropEvent() of the view cannot be triggered.
This kind of weird because even if I'm trying to drop on a line edit widget (which accepts drop by default) of the QWidget (parent of the view), the mouse icon is still big "unavailable", which looks like the whole widget is disabled for dropping.
But when I check the acceptDrops() on click the view, it does return true.

Any ideas please? Thanks in advance.

Seishin
9th July 2013, 16:19
Found the reason but I don't know why. When I call setViewport() of the QGraphicsView, if I set the viewport to QGLWidget, drop is working; but if I set the viewport to QWidget, drop is not working any more.
Anyone knows the reason?
Thanks.

萨满
31st October 2013, 09:48
I have the same issue.