Qt 4.8
|
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framework. More...
#include <qgraphicssceneevent.h>
Public Functions | |
void | acceptProposedAction () |
Sets the proposed action as accepted, i.e, the drop action is set to the proposed action. More... | |
Qt::MouseButtons | buttons () const |
Returns a Qt::MouseButtons value indicating which buttons were pressed on the mouse when this mouse event was generated. More... | |
Qt::DropAction | dropAction () const |
Returns the action that was performed in this drag and drop. More... | |
const QMimeData * | mimeData () const |
This function returns the MIME data of the event. More... | |
Qt::KeyboardModifiers | modifiers () const |
Returns the keyboard modifiers that were pressed when the drag and drop event was created. More... | |
QPointF | pos () const |
Returns the mouse position of the event relative to the view that sent the event. More... | |
Qt::DropActions | possibleActions () const |
Returns the possible drop actions that the drag and drop can result in. More... | |
Qt::DropAction | proposedAction () const |
Returns the drop action that is proposed, i.e., preferred. More... | |
QGraphicsSceneDragDropEvent (Type type=None) | |
Constructs a new QGraphicsSceneDragDropEvent of the specified type. More... | |
QPointF | scenePos () const |
Returns the position of the mouse in scene coordinates. More... | |
QPoint | screenPos () const |
Returns the position of the mouse relative to the screen. More... | |
void | setButtons (Qt::MouseButtons buttons) |
Sets the mouse buttons that were pressed when the event was created to buttons. More... | |
void | setDropAction (Qt::DropAction action) |
This function lets the receiver of the drop set the drop action that was performed to action, which should be one of the possible actions. More... | |
void | setMimeData (const QMimeData *data) |
This function sets the MIME data for the event. More... | |
void | setModifiers (Qt::KeyboardModifiers modifiers) |
Sets the keyboard modifiers that were pressed when the event was created to modifiers. More... | |
void | setPos (const QPointF &pos) |
Sets the position of the mouse to pos; this should be relative to the widget that generated the event, which normally is a QGraphicsView. More... | |
void | setPossibleActions (Qt::DropActions actions) |
Sets the possible drop actions that the drag can result in to actions. More... | |
void | setProposedAction (Qt::DropAction action) |
Sets the proposed action to action. More... | |
void | setScenePos (const QPointF &pos) |
Sets the scene position of the mouse to pos. More... | |
void | setScreenPos (const QPoint &pos) |
Sets the mouse position relative to the screen to pos. More... | |
void | setSource (QWidget *source) |
This function set the source widget, i. More... | |
QWidget * | source () const |
This function returns the QGraphicsView that created the QGraphicsSceneDragDropEvent. More... | |
~QGraphicsSceneDragDropEvent () | |
Destroys the object. More... | |
Public Functions inherited from QGraphicsSceneEvent | |
QGraphicsSceneEvent (Type type) | |
Constructs a generic graphics scene event of the specified type. More... | |
void | setWidget (QWidget *widget) |
Sets the widget related to this event. More... | |
QWidget * | widget () const |
Returns the widget where the event originated, or 0 if the event originates from another application. More... | |
~QGraphicsSceneEvent () | |
Destroys the event. More... | |
Public Functions inherited from QEvent | |
void | accept () |
Sets the accept flag of the event object, the equivalent of calling setAccepted(true). More... | |
void | ignore () |
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false). More... | |
bool | isAccepted () const |
QEvent (Type type) | |
Contructs an event object of type type. More... | |
void | setAccepted (bool accepted) |
bool | spontaneous () const |
Returns true if the event originated outside the application (a system event); otherwise returns false. More... | |
Type | type () const |
Returns the event type. More... | |
virtual | ~QEvent () |
Destroys the event. More... | |
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framework.
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 QGraphicsItem::setAcceptDrops().
Definition at line 246 of file qgraphicssceneevent.h.
Constructs a new QGraphicsSceneDragDropEvent of the specified type.
The type can be either QEvent::GraphicsSceneDragEnter, QEvent::GraphicsSceneDragLeave, QEvent::GraphicsSceneDragMove, or QEvent::GraphicsSceneDrop.
Definition at line 1361 of file qgraphicssceneevent.cpp.
QGraphicsSceneDragDropEvent::~QGraphicsSceneDragDropEvent | ( | ) |
void QGraphicsSceneDragDropEvent::acceptProposedAction | ( | ) |
Sets the proposed action as accepted, i.e, the drop action is set to the proposed action.
This is equal to:
When using this function, one should not call accept()
.
Definition at line 1585 of file qgraphicssceneevent.cpp.
Referenced by QTextControl::processEvent().
Qt::MouseButtons QGraphicsSceneDragDropEvent::buttons | ( | ) | const |
Returns a Qt::MouseButtons value indicating which buttons were pressed on the mouse when this mouse event was generated.
Definition at line 1462 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), setButtons(), and QGraphicsViewPrivate::storeDragDropEvent().
Qt::DropAction QGraphicsSceneDragDropEvent::dropAction | ( | ) | const |
Returns the action that was performed in this drag and drop.
This should be set by the receiver of the drop and is returned by QDrag::exec().
Definition at line 1599 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QGraphicsView::dragEnterEvent(), QGraphicsProxyWidget::dragMoveEvent(), QGraphicsView::dragMoveEvent(), QGraphicsScene::dragMoveEvent(), QGraphicsView::dropEvent(), QTextControl::processEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
const QMimeData * QGraphicsSceneDragDropEvent::mimeData | ( | ) | const |
This function returns the MIME data of the event.
Definition at line 1647 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QTextControl::processEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
Qt::KeyboardModifiers QGraphicsSceneDragDropEvent::modifiers | ( | ) | const |
Returns the keyboard modifiers that were pressed when the drag and drop event was created.
Definition at line 1490 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), setModifiers(), and QGraphicsViewPrivate::storeDragDropEvent().
QPointF QGraphicsSceneDragDropEvent::pos | ( | ) | const |
Returns the mouse position of the event relative to the view that sent the event.
Definition at line 1379 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), QGraphicsProxyWidget::dragEnterEvent(), QGraphicsProxyWidget::dropEvent(), QTextControl::processEvent(), setPos(), setScenePos(), and setScreenPos().
Qt::DropActions QGraphicsSceneDragDropEvent::possibleActions | ( | ) | const |
Returns the possible drop actions that the drag and drop can result in.
Definition at line 1520 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QGraphicsProxyWidget::dragMoveEvent(), QGraphicsProxyWidget::dropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
Qt::DropAction QGraphicsSceneDragDropEvent::proposedAction | ( | ) | const |
Returns the drop action that is proposed, i.e., preferred.
The action must be one of the possible actions as defined by possibleActions()
.
Definition at line 1550 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QGraphicsProxyWidget::dragMoveEvent(), QGraphicsScene::dragMoveEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
QPointF QGraphicsSceneDragDropEvent::scenePos | ( | ) | const |
Returns the position of the mouse in scene coordinates.
Definition at line 1408 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), QGraphicsScenePrivate::sendDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
QPoint QGraphicsSceneDragDropEvent::screenPos | ( | ) | const |
Returns the position of the mouse relative to the screen.
Definition at line 1434 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), QGraphicsScene::dragMoveEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setButtons | ( | Qt::MouseButtons | buttons | ) |
Sets the mouse buttons that were pressed when the event was created to buttons.
Definition at line 1478 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setDropAction | ( | Qt::DropAction | action | ) |
This function lets the receiver of the drop set the drop action that was performed to action, which should be one of the possible actions.
Call accept()
in stead of acceptProposedAction()
if you use this function.
Definition at line 1614 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QGraphicsProxyWidget::dragEnterEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsScene::dragMoveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setMimeData | ( | const QMimeData * | data | ) |
This function sets the MIME data for the event.
Definition at line 1660 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setModifiers | ( | Qt::KeyboardModifiers | modifiers | ) |
Sets the keyboard modifiers that were pressed when the event was created to modifiers.
Definition at line 1507 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setPos | ( | const QPointF & | pos | ) |
Sets the position of the mouse to pos; this should be relative to the widget that generated the event, which normally is a QGraphicsView.
Definition at line 1397 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), and QGraphicsScenePrivate::sendDragDropEvent().
void QGraphicsSceneDragDropEvent::setPossibleActions | ( | Qt::DropActions | actions | ) |
Sets the possible drop actions that the drag can result in to actions.
Definition at line 1536 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setProposedAction | ( | Qt::DropAction | action | ) |
Sets the proposed action to action.
possibleActions()
.Definition at line 1568 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setScenePos | ( | const QPointF & | pos | ) |
Sets the scene position of the mouse to pos.
Definition at line 1423 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setScreenPos | ( | const QPoint & | pos | ) |
Sets the mouse position relative to the screen to pos.
Definition at line 1449 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), cloneEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
void QGraphicsSceneDragDropEvent::setSource | ( | QWidget * | source | ) |
This function set the source widget, i.
Definition at line 1638 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QGraphicsView::dragLeaveEvent(), QGraphicsViewPrivate::populateSceneDragDropEvent(), and QGraphicsViewPrivate::storeDragDropEvent().
QWidget * QGraphicsSceneDragDropEvent::source | ( | ) | const |
This function returns the QGraphicsView that created the QGraphicsSceneDragDropEvent.
Definition at line 1624 of file qgraphicssceneevent.cpp.
Referenced by QGraphicsScenePrivate::cloneDragDropEvent(), QTextControl::processEvent(), setSource(), and QGraphicsViewPrivate::storeDragDropEvent().