QDragMoveEvent Class

The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress. More...

Header: #include <QDragMoveEvent>
qmake: QT += gui
Inherits: QDropEvent
Inherited By:

QDragEnterEvent

Public Functions

QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QEvent::Type type = DragMove)
virtual ~QDragMoveEvent()
void accept()
void accept(const QRect &r)
QRect answerRect() const
void ignore()
void ignore(const QRect &r)
  • 11 public functions inherited from QDropEvent
  • 6 public functions inherited from QEvent

Protected Variables

QRect rect

Additional Inherited Members

  • 1 property inherited from QEvent
  • 1 static public member inherited from QEvent

Detailed Description

The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress.

A widget will receive drag move events repeatedly while the drag is within its boundaries, if it accepts drop events and enter events. The widget should examine the event to see what kind of data it provides, and call the accept() function to accept the drop if appropriate.

The rectangle supplied by the answerRect() function can be used to restrict drops to certain parts of the widget. For example, we can check whether the rectangle intersects with the geometry of a certain child widget and only call acceptProposedAction() if that is the case.

Note that this class inherits most of its functionality from QDropEvent.

See also QDragEnterEvent, QDragLeaveEvent, and QDropEvent.

Member Function Documentation

QDragMoveEvent::QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QEvent::Type type = DragMove)

Creates a QDragMoveEvent of the required type indicating that the mouse is at position pos given within a widget.

The mouse and keyboard states are specified by buttons and modifiers, and the actions describe the types of drag and drop operation that are possible. The drag data is passed as MIME-encoded information in data.

Warning: Do not attempt to create a QDragMoveEvent yourself. These objects rely on Qt's internal state.

[virtual] QDragMoveEvent::~QDragMoveEvent()

Destroys the event.

void QDragMoveEvent::accept()

void QDragMoveEvent::accept(const QRect &r)

QRect QDragMoveEvent::answerRect() const

void QDragMoveEvent::ignore()

void QDragMoveEvent::ignore(const QRect &r)