Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The TQDragObject class encapsulates MIME-based data transfer. More...
#include <ntqdragobject.h>
Inherits TQObject and TQMimeSource.
Inherited by TQStoredDrag, TQTextDrag, TQImageDrag, and TQIconDrag.
The TQDragObject class encapsulates MIME-based data transfer.
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.
See the Drag-and-drop documentation for an overview of how to provide drag and drop in your application.
See the TQClipboard documentation for an overview of how to provide cut-and-paste in your application.
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().
See also Drag And Drop Classes.
This enum describes the possible drag modes.
Note that the drag object will be deleted when dragSource is deleted.
The function returns TRUE if the caller should delete the original copy of the dragged data (but see target()); otherwise returns FALSE.
If the drag contains references 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 must not delete the files!)
Note that on Windows the drag operation will spin a blocking modal event loop that will not dispatch any TQTimers.
Example: dirview/dirview.cpp.
Starts a drag operation using the contents of this object.
At this point, the object becomes owned by TQt, 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.
Returns TRUE if the dragged data was dragged as a move, indicating that the caller should remove the original source of the data (the drag object must continue to have a copy); otherwise returns FALSE.
The mode specifies the drag mode (see TQDragObject::DragMode.) Normally one of the simpler drag(), dragMove(), or dragCopy() functions would be used instead.
See also drag(), dragMove(), and dragLink().
Example: iconview/simple_dd/main.cpp.
See also drag(), dragCopy(), and dragMove().
See also drag(), dragCopy(), and dragLink().
The hotspot 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.
Warning: 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.
Example: fileiconview/qfileiconview.cpp.
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.
This can be useful for detecting the case where drag and drop is to and from the same widget.
This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.
Copyright © 2007 Trolltech | Trademarks | TQt 3.3.8
|