QGraphicsSceneDragDropEvent Class

The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framework. More...

Header: #include <QGraphicsSceneDragDropEvent>
qmake: QT += widgets
Since: Qt 4.2
Inherits: QGraphicsSceneEvent

This class was introduced in Qt 4.2.

Detailed Description

QGraphicsView inherits the drag and drop functionality provided by QWidget. When it receives a drag and drop event, it translates it to a QGraphicsSceneDragDropEvent.

QGraphicsSceneDragDropEvent stores events of type GraphicsSceneDragEnter, GraphicsSceneDragLeave, GraphicsSceneDragMove, or GraphicsSceneDrop.

QGraphicsSceneDragDropEvent contains the position of the mouse cursor in both item, scene, and screen coordinates; this can be retrieved with pos(), scenePos(), and screenPos().

The scene sends the event to the first QGraphicsItem under the mouse cursor that accepts drops; a graphics item is set to accept drops with setAcceptDrops().