Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QGraphicsItem::dragEnterEvent ( QGraphicsSceneDragDropEvent event  )  [protected, virtual, inherited]

This event handler, for event event, can be reimplemented to receive drag enter events for this item. Drag enter events are generated as the cursor enters the item's area.

By accepting the event, (i.e., by calling QEvent::accept(),) the item will accept drop events, in addition to receiving drag move and drag leave. Otherwise, the event will be ignored and propagate to the item beneath. If the event is accepted, the item will receive a drag move event before control goes back to the event loop.

A common implementation of dragEnterEvent accepts or ignores event depending on the associated mime data in event. Example:

        CustomItem::CustomItem()
        {
            setAcceptDrops(true);
            ...
        }

        void CustomItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
        {
            event->setAccepted(event->mimeData()->hasFormat("text/plain"));
        }

Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true).

The default implementation does nothing.

See also:
dropEvent(), dragMoveEvent(), dragLeaveEvent()

Reimplemented in QGraphicsTextItem.

Definition at line 3195 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::sceneEvent().

{
    Q_UNUSED(event);
}


Generated by  Doxygen 1.6.0   Back to index