📄 qdragobject.3qt
字号:
'\" t.TH QDragObject 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQDragObject \- Encapsulates MIME-based data transfer.PP\fC#include <qdragobject.h>\fR.PPInherits QObject and QMimeSource..PPInherited by QStoredDrag, QTextDrag, QImageDrag and QIconDrag..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQDragObject\fR ( QWidget * dragSource = 0, const char * name = 0 )".br.ti -1c.BI "virtual \fB~QDragObject\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 ( QPixmap pm )".br.ti -1c.BI "virtual void \fBsetPixmap\fR ( QPixmap pm, const QPoint & hotspot )".br.ti -1c.BI "QPixmap \fBpixmap\fR () const".br.ti -1c.BI "QPoint \fBpixmapHotSpot\fR () const".br.ti -1c.BI "QWidget * \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 "QWidget * \fBtarget\fR ()".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual bool \fBdrag\fR ( DragMode mode )".br.in -1c.SH DESCRIPTIONThe QDragObject class encapsulates MIME-based data transfer..PPQDragObject 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..PPSee the Drag-and-drop documentation for an overview of how to provide drag and drop in your application..PPSee the QClipboard documentation for an overview of how to provide cut-and-paste in your application..PPThe 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()..PPSee 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..SH MEMBER FUNCTION DOCUMENTATION.SH "QDragObject::QDragObject ( QWidget * dragSource = 0, const char * name = 0 )"Constructs a drag object called \fIname\fR, which is a child of \fIdragSource\fR..PPNote that the drag object will be deleted when \fIdragSource\fR is deleted..SH "QDragObject::~QDragObject ()\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 QDragObject::drag ()"Starts a drag operation using the contents of this object, using DragDefault mode..PPThe function returns TRUE if the caller should delete the original copy of the dragged data (but see target())..PPIf the drag contains \fIreferences\fR to information (eg. 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 (eg. the file manager starts a background process to move files, so the source \fImust not\fR delete the files!).PPExample: dirview/dirview.cpp..SH "bool QDragObject::drag ( DragMode mode )\fC [virtual protected]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPStarts a drag operation using the contents of this object..PPAt this point, the object becomes owned by Qt, not the application. You should not delete the drag object nor 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..PPReturns 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)..PPThe \fImode\fR specifies the drag mode (see QDragObject::DragMode.) Normally one of the simpler drag(), dragMove(), or dragCopy() functions would be used instead..PP\fBWarning:\fR in Qt 1.x, drag operations all return FALSE..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()..PPSee also drag(), dragMove() and dragLink()..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()..PPSee 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()..PPSee also drag(), dragCopy() and dragLink()..SH "QPixmap QDragObject::pixmap () const"Returns the currently set pixmap (which isNull() if none is set)..SH "QPoint QDragObject::pixmapHotSpot () const"Returns the currently set pixmap hotspot..SH "void QDragObject::setPixmap ( QPixmap pm, const QPoint & 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..PPThe \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..PPExample: fileiconview/qfileiconview.cpp..SH "void QDragObject::setPixmap ( QPixmap pm )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPUses 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 "QWidget * QDragObject::source ()"Returns a pointer to the drag source where this object originated..SH "QWidget * QDragObject::target ()\fC [static]\fR"After the drag completes, this function will return the QWidget which received the drop, or 0 if the data was dropped on another application..PPThis can be useful for detecting the case where drag and drop is toand from the same widget..SH "SEE ALSO".BR http://doc.trolltech.com/qdragobject.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf 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..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qdragobject.3qt) and the Qtversion (3.0.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -