'\" t .TH TQDragObject 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. .\" .ad l .nh .SH NAME TQDragObject \- Encapsulates MIME-based data transfer .SH SYNOPSIS \fC#include \fR .PP Inherits TQObject and TQMimeSource. .PP Inherited by TQStoredDrag, TQTextDrag, TQImageDrag, and TQIconDrag. .PP .SS "Public Members" .in +1c .ti -1c .BI "\fBTQDragObject\fR ( TQWidget * dragSource = 0, const char * name = 0 )" .br .ti -1c .BI "virtual \fB~TQDragObject\fR ()" .br .ti -1c .BI "bool \fBdrag\fR ()" .br .ti -1c .BI "bool \fBdragMove\fR ()" .br .ti -1c .BI "void \fBdragCopy\fR ()" .br .ti -1c .BI "void \fBdragLink\fR ()" .br .ti -1c .BI "virtual void \fBsetPixmap\fR ( TQPixmap pm )" .br .ti -1c .BI "virtual void \fBsetPixmap\fR ( TQPixmap pm, const TQPoint & hotspot )" .br .ti -1c .BI "TQPixmap \fBpixmap\fR () const" .br .ti -1c .BI "TQPoint \fBpixmapHotSpot\fR () const" .br .ti -1c .BI "TQWidget * \fBsource\fR ()" .br .ti -1c .BI "enum \fBDragMode\fR { DragDefault, DragCopy, DragMove, DragLink, DragCopyOrMove }" .br .in -1c .SS "Static Public Members" .in +1c .ti -1c .BI "TQWidget * \fBtarget\fR ()" .br .in -1c .SS "Protected Members" .in +1c .ti -1c .BI "virtual bool \fBdrag\fR ( DragMode mode )" .br .in -1c .SH DESCRIPTION The TQDragObject class encapsulates MIME-based data transfer. .PP TQDragObject 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 TQClipboard 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 "TQDragObject::DragMode" This enum describes the possible drag modes. .TP \fCTQDragObject::DragDefault\fR - The mode is determined heuristically. .TP \fCTQDragObject::DragCopy\fR - The data is copied, never moved. .TP \fCTQDragObject::DragMove\fR - The data is moved, if dragged at all. .TP \fCTQDragObject::DragLink\fR - The data is linked, if dragged at all. .TP \fCTQDragObject::DragCopyOrMove\fR - The user chooses the mode by using a control key to switch from the default. .SH MEMBER FUNCTION DOCUMENTATION .SH "TQDragObject::TQDragObject ( TQWidget * dragSource = 0, const char * name = 0 )" Constructs a drag object called \fIname\fR, which is a child of \fIdragSource\fR. .PP Note that the drag object will be deleted when \fIdragSource\fR is deleted. .SH "TQDragObject::~TQDragObject ()\fC [virtual]\fR" Destroys the drag object, canceling any drag and drop operation in which it is involved, and frees up the storage used. .SH "bool TQDragObject::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 TQUriDrag 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 TQTimers. .PP Example: dirview/dirview.cpp. .SH "bool TQDragObject::drag ( DragMode mode )\fC [virtual protected]\fR" 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 TQDragObject::DragMode.) Normally one of the simpler drag(), dragMove(), or dragCopy() functions would be used instead. .SH "void TQDragObject::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 TQDragObject::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 TQDragObject::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 "TQPixmap TQDragObject::pixmap () const" Returns the currently set pixmap (which isNull() if none is set). .SH "TQPoint TQDragObject::pixmapHotSpot () const" Returns the currently set pixmap hotspot. .SH "void TQDragObject::setPixmap ( TQPixmap pm, const TQPoint & hotspot )\fC [virtual]\fR" 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. .PP Example: fileiconview/tqfileiconview.cpp. .SH "void TQDragObject::setPixmap ( TQPixmap pm )\fC [virtual]\fR" 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. .SH "TQWidget * TQDragObject::source ()" Returns a pointer to the drag source where this object originated. .SH "TQWidget * TQDragObject::target ()\fC [static]\fR" After the drag completes, this function will return the TQWidget which received the drop, or 0 if the data was dropped on another application. .PP This can be useful for detecting the case where drag and drop is to and from the same widget. .SH "SEE ALSO" .BR http://doc.trolltech.com/tqdragobject.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. .SH AUTHOR Generated automatically from the source code. .SH BUGS If you find a bug in Qt, please report it as described in .BR http://doc.trolltech.com/bughowto.html . Good bug reports help us to help you. Thank you. .P The definitive TQt documentation is provided in HTML format; it is located at $TQTDIR/doc/html and can be read using TQt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. .P If you find errors in this manual page, please report them to .BR qt-bugs@trolltech.com . Please include the name of the manual page (tqdragobject.3qt) and the Qt version (3.3.8).