Qt 4.8
|
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress. More...
#include <qevent.h>
Public Functions | |
void | accept () |
Calls QDropEvent::accept(). More... | |
void | accept (const QRect &r) |
The same as accept(), but also notifies that future moves will also be acceptable if they remain within the rectangle given on the widget. More... | |
QRect | answerRect () const |
Returns the rectangle in the widget where the drop will occur if accepted. More... | |
void | ignore () |
Calls QDropEvent::ignore(). More... | |
void | ignore (const QRect &r) |
The opposite of the accept(const QRect&) function. More... | |
QDragMoveEvent (const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type=DragMove) | |
Creates a QDragMoveEvent of the required type indicating that the mouse is at position pos given within a widget. More... | |
~QDragMoveEvent () | |
Destroys the event. More... | |
Public Functions inherited from QDropEvent | |
void | acceptProposedAction () |
Sets the drop action to be the proposed action. More... | |
Qt::DropAction | dropAction () const |
Returns the action to be performed on the data by the target. More... | |
QByteArray | encodedData (const char *) const |
Returns a byte array containing the drag's data, in format. More... | |
const char * | format (int n=0) const |
Returns a string describing one of the available data types for this drag. More... | |
Qt::KeyboardModifiers | keyboardModifiers () const |
Returns the modifier keys that are pressed. More... | |
const QMimeData * | mimeData () const |
Returns the data that was dropped on the widget and its associated MIME type information. More... | |
Qt::MouseButtons | mouseButtons () const |
Returns the mouse buttons that are pressed. More... | |
const QPoint & | pos () const |
Returns the position where the drop was made. More... | |
Qt::DropActions | possibleActions () const |
Returns an OR-combination of possible drop actions. More... | |
Qt::DropAction | proposedAction () const |
Returns the proposed drop action. More... | |
bool | provides (const char *) const |
Returns true if this event provides format mimeType; otherwise returns false. More... | |
QDropEvent (const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type=Drop) | |
Constructs a drop event of a certain type corresponding to a drop at the point specified by pos in the destination widget's coordinate system. More... | |
void | setDropAction (Qt::DropAction action) |
Sets the action to be performed on the data by the target. More... | |
QWidget * | source () const |
If the source of the drag operation is a widget in this application, this function returns that source; otherwise it returns 0. More... | |
~QDropEvent () | |
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... | |
Public Functions inherited from QMimeSource | |
virtual | ~QMimeSource () |
Destroys the MIME source. More... | |
Protected Variables | |
QRect | rect |
Protected Variables inherited from QDropEvent | |
Qt::DropActions | act |
Qt::DropAction | default_action |
Qt::DropAction | drop_action |
QList< QByteArray > | fmts |
const QMimeData * | mdata |
Qt::KeyboardModifiers | modState |
Qt::MouseButtons | mouseState |
QPoint | p |
Protected Variables inherited from QEvent | |
QEventPrivate * | d |
ushort | t |
Friends | |
class | QApplication |
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 QWidget::dragEnterEvent() . 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.
QDragMoveEvent::QDragMoveEvent | ( | const QPoint & | pos, |
Qt::DropActions | actions, | ||
const QMimeData * | data, | ||
Qt::MouseButtons | buttons, | ||
Qt::KeyboardModifiers | modifiers, | ||
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.
Definition at line 2507 of file qevent.cpp.
QDragMoveEvent::~QDragMoveEvent | ( | ) |
|
inline |
Calls QDropEvent::accept().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 539 of file qevent.h.
Referenced by QColorWell::dragEnterEvent(), QColorShowLabel::dragEnterEvent(), QColorWell::dragMoveEvent(), QOleDropTarget::DragOver(), QIconModeViewBase::filterDragMoveEvent(), handle_xdnd_position(), QX11Data::motifdndHandle(), qt_mac_mouse_inside_answer_rect(), and QOleDropTarget::sendDragEnterEvent().
|
inline |
The same as accept(), but also notifies that future moves will also be acceptable if they remain within the rectangle given on the widget.
This can improve performance, but may also be ignored by the underlying system.
If the rectangle is empty, drag move events will be sent continuously. This is useful if the source is scrolling in a timer event.
Definition at line 542 of file qevent.h.
Referenced by accept().
|
inline |
Returns the rectangle in the widget where the drop will occur if accepted.
You can use this information to restrict drops to certain places on the widget.
Definition at line 537 of file qevent.h.
Referenced by QOleDropTarget::DragOver(), handle_xdnd_position(), qt_mac_copy_answer_rect(), and QOleDropTarget::sendDragEnterEvent().
|
inline |
Calls QDropEvent::ignore().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 540 of file qevent.h.
Referenced by QColorWell::dragEnterEvent(), QColorShowLabel::dragEnterEvent(), QColorWell::dragMoveEvent(), and QIconModeViewBase::filterDragMoveEvent().
|
inline |
The opposite of the accept(const QRect&) function.
Moves within the rectangle are not acceptable, and will be ignored.
Definition at line 543 of file qevent.h.
Referenced by ignore().
|
friend |