The QDragObject class encapsulates MIME-based data transfer.
.PP
QDragObject is the base class for all data that needs to be transferred between and within applications, both for drag and drop and for the clipboard.
.PP
See the Drag-and-drop documentation for an overview of how to provide drag and drop in your application.
.PP
See the QClipboard documentation for an overview of how to provide cut-and-paste in your application.
.PP
The drag() function is used to start a drag operation. You can specify the DragMode in the call or use one of the convenience functions dragCopy(), dragMove() or dragLink(). The drag source where the data originated is retrieved with source(). If the data was dropped on a widget within the application, target() will return a pointer to that widget. Specify the pixmap to display during the drag with setPixmap().
.PP
See also Drag And Drop Classes.
.SS "Member Type Documentation"
.SH "QDragObject::DragMode"
This enum describes the possible drag modes.
.TP
\fCQDragObject::DragDefault\fR - The mode is determined heuristically.
.TP
\fCQDragObject::DragCopy\fR - The data is copied, never moved.
.TP
\fCQDragObject::DragMove\fR - The data is moved, if dragged at all.
.TP
\fCQDragObject::DragLink\fR - The data is linked, if dragged at all.
.TP
\fCQDragObject::DragCopyOrMove\fR - The user chooses the mode by using a control key to switch from the default.
Destroys the drag object, canceling any drag and drop operation in which it is involved, and frees up the storage used.
.SH "bool QDragObject::drag ()"
Starts a drag operation using the contents of this object, using DragDefault mode.
.PP
The function returns TRUE if the caller should delete the original copy of the dragged data (but see target()); otherwise returns FALSE.
.PP
If the drag contains \fIreferences\fR to information (e.g. file names in a QUriDrag are references) then the return value should always be ignored, as the target is expected to manipulate the referred-to content directly. On X11 the return value should always be correct anyway, but on Windows this is not necessarily the case (e.g. the file manager starts a background process to move files, so the source \fImust not\fR delete the files!)
.PP
Note that on Windows the drag operation will spin a blocking modal event loop that will not dispatch any QTimers.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Starts a drag operation using the contents of this object.
.PP
At this point, the object becomes owned by Qt, not the application. You should not delete the drag object or anything it references. The actual transfer of data to the target application will be done during future event processing - after that time the drag object will be deleted.
.PP
Returns TRUE if the dragged data was dragged as a \fImove\fR, indicating that the caller should remove the original source of the data (the drag object must continue to have a copy); otherwise returns FALSE.
.PP
The \fImode\fR specifies the drag mode (see QDragObject::DragMode.) Normally one of the simpler drag(), dragMove(), or dragCopy() functions would be used instead.
.SH "void QDragObject::dragCopy ()"
Starts a drag operation using the contents of this object, using DragCopy mode. Be sure to read the constraints described in drag().
.PP
See also drag(), dragMove(), and dragLink().
.PP
Example: iconview/simple_dd/main.cpp.
.SH "void QDragObject::dragLink ()"
Starts a drag operation using the contents of this object, using DragLink mode. Be sure to read the constraints described in drag().
.PP
See also drag(), dragCopy(), and dragMove().
.SH "bool QDragObject::dragMove ()"
Starts a drag operation using the contents of this object, using DragMove mode. Be sure to read the constraints described in drag().
.PP
See also drag(), dragCopy(), and dragLink().
.SH "QPixmap QDragObject::pixmap () const"
Returns the currently set pixmap (which isNull() if none is set).
Set the pixmap \fIpm\fR to display while dragging the object. The platform-specific implementation will use this where it can - so provide a small masked pixmap, and do not assume that the user will actually see it. For example, cursors on Windows 95 are of limited size.
.PP
The \fIhotspot\fR is the point on (or off) the pixmap that should be under the cursor as it is dragged. It is relative to the top-left pixel of the pixmap.
.PP
\fBWarning:\fR We have seen problems with drag cursors on different graphics hardware and driver software on Windows. Setting the graphics acceleration in the display settings down one tick solved the problems in all cases.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Uses a hotspot that positions the pixmap below and to the right of the mouse pointer. This allows the user to clearly see the point on the window which they are dragging the data onto.