[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qdragobject.cpp:571 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QDragObject Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDragObject Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QDragObject class encapsulates MIME-based data
|
---|
| 35 | transfer.
|
---|
| 36 | <a href="#details">More...</a>
|
---|
| 37 | <p><tt>#include <<a href="qdragobject-h.html">qdragobject.h</a>></tt>
|
---|
| 38 | <p>Inherits <a href="qobject.html">QObject</a> and <a href="qmimesource.html">QMimeSource</a>.
|
---|
| 39 | <p>Inherited by <a href="qstoreddrag.html">QStoredDrag</a>, <a href="qtextdrag.html">QTextDrag</a>, <a href="qimagedrag.html">QImageDrag</a>, and <a href="qicondrag.html">QIconDrag</a>.
|
---|
| 40 | <p><a href="qdragobject-members.html">List of all member functions.</a>
|
---|
| 41 | <h2>Public Members</h2>
|
---|
| 42 | <ul>
|
---|
| 43 | <li class=fn><a href="#QDragObject"><b>QDragObject</b></a> ( QWidget * dragSource = 0, const char * name = 0 )</li>
|
---|
| 44 | <li class=fn>virtual <a href="#~QDragObject"><b>~QDragObject</b></a> ()</li>
|
---|
| 45 | <li class=fn>bool <a href="#drag"><b>drag</b></a> ()</li>
|
---|
| 46 | <li class=fn>bool <a href="#dragMove"><b>dragMove</b></a> ()</li>
|
---|
| 47 | <li class=fn>void <a href="#dragCopy"><b>dragCopy</b></a> ()</li>
|
---|
| 48 | <li class=fn>void <a href="#dragLink"><b>dragLink</b></a> ()</li>
|
---|
| 49 | <li class=fn>virtual void <a href="#setPixmap-2"><b>setPixmap</b></a> ( QPixmap pm )</li>
|
---|
| 50 | <li class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( QPixmap pm, const QPoint & hotspot )</li>
|
---|
| 51 | <li class=fn>QPixmap <a href="#pixmap"><b>pixmap</b></a> () const</li>
|
---|
| 52 | <li class=fn>QPoint <a href="#pixmapHotSpot"><b>pixmapHotSpot</b></a> () const</li>
|
---|
| 53 | <li class=fn>QWidget * <a href="#source"><b>source</b></a> ()</li>
|
---|
| 54 | <li class=fn>enum <a href="#DragMode-enum"><b>DragMode</b></a> { DragDefault, DragCopy, DragMove, DragLink, DragCopyOrMove }</li>
|
---|
| 55 | </ul>
|
---|
| 56 | <h2>Static Public Members</h2>
|
---|
| 57 | <ul>
|
---|
| 58 | <li class=fn>QWidget * <a href="#target"><b>target</b></a> ()</li>
|
---|
| 59 | </ul>
|
---|
| 60 | <h2>Protected Members</h2>
|
---|
| 61 | <ul>
|
---|
| 62 | <li class=fn>virtual bool <a href="#drag-2"><b>drag</b></a> ( DragMode mode )</li>
|
---|
| 63 | </ul>
|
---|
| 64 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | <p> The QDragObject class encapsulates MIME-based data
|
---|
| 68 | transfer.
|
---|
| 69 | <p>
|
---|
| 70 | <p> QDragObject is the base class for all data that needs to be
|
---|
| 71 | transferred between and within applications, both for drag and
|
---|
| 72 | drop and for the <a href="qclipboard.html">clipboard</a>.
|
---|
| 73 | <p> See the <a href="dnd.html">Drag-and-drop documentation</a> for an
|
---|
| 74 | overview of how to provide drag and drop in your application.
|
---|
| 75 | <p> See the <a href="qclipboard.html">QClipboard</a> documentation for an overview of how to provide
|
---|
| 76 | cut-and-paste in your application.
|
---|
| 77 | <p> The <a href="#drag">drag</a>() function is used to start a drag operation. You can
|
---|
| 78 | specify the <a href="#DragMode-enum">DragMode</a> in the call or use one of the convenience
|
---|
| 79 | functions <a href="#dragCopy">dragCopy</a>(), <a href="#dragMove">dragMove</a>() or <a href="#dragLink">dragLink</a>(). The drag source
|
---|
| 80 | where the data originated is retrieved with <a href="#source">source</a>(). If the data
|
---|
| 81 | was dropped on a widget within the application, <a href="#target">target</a>() will
|
---|
| 82 | return a pointer to that widget. Specify the pixmap to display
|
---|
| 83 | during the drag with <a href="#setPixmap">setPixmap</a>().
|
---|
| 84 | <p>See also <a href="draganddrop.html">Drag And Drop Classes</a>.
|
---|
| 85 |
|
---|
| 86 | <hr><h2>Member Type Documentation</h2>
|
---|
| 87 | <h3 class=fn><a name="DragMode-enum"></a>QDragObject::DragMode</h3>
|
---|
| 88 |
|
---|
| 89 | <p> This enum describes the possible drag modes.
|
---|
| 90 | <ul>
|
---|
| 91 | <li><tt>QDragObject::DragDefault</tt> - The mode is determined heuristically.
|
---|
| 92 | <li><tt>QDragObject::DragCopy</tt> - The data is copied, never moved.
|
---|
| 93 | <li><tt>QDragObject::DragMove</tt> - The data is moved, if dragged at all.
|
---|
| 94 | <li><tt>QDragObject::DragLink</tt> - The data is linked, if dragged at all.
|
---|
| 95 | <li><tt>QDragObject::DragCopyOrMove</tt> - The user chooses the mode by using a
|
---|
| 96 | control key to switch from the default.
|
---|
| 97 | </ul>
|
---|
| 98 | <hr><h2>Member Function Documentation</h2>
|
---|
| 99 | <h3 class=fn><a name="QDragObject"></a>QDragObject::QDragObject ( <a href="qwidget.html">QWidget</a> * dragSource = 0, const char * name = 0 )
|
---|
| 100 | </h3>
|
---|
| 101 | Constructs a drag object called <em>name</em>, which is a child of <em>dragSource</em>.
|
---|
| 102 | <p> Note that the drag object will be deleted when <em>dragSource</em> is
|
---|
| 103 | deleted.
|
---|
| 104 |
|
---|
| 105 | <h3 class=fn><a name="~QDragObject"></a>QDragObject::~QDragObject ()<tt> [virtual]</tt>
|
---|
| 106 | </h3>
|
---|
| 107 | Destroys the drag object, canceling any drag and drop operation in
|
---|
| 108 | which it is involved, and frees up the storage used.
|
---|
| 109 |
|
---|
| 110 | <h3 class=fn>bool <a name="drag"></a>QDragObject::drag ()
|
---|
| 111 | </h3>
|
---|
| 112 | Starts a drag operation using the contents of this object, using
|
---|
| 113 | DragDefault mode.
|
---|
| 114 | <p> The function returns TRUE if the caller should delete the original
|
---|
| 115 | copy of the dragged data (but see <a href="#target">target</a>()); otherwise returns
|
---|
| 116 | FALSE.
|
---|
| 117 | <p> If the drag contains <em>references</em> to information (e.g. file names
|
---|
| 118 | in a <a href="quridrag.html">QUriDrag</a> are references) then the return value should always
|
---|
| 119 | be ignored, as the target is expected to manipulate the
|
---|
| 120 | referred-to content directly. On X11 the return value should
|
---|
| 121 | always be correct anyway, but on Windows this is not necessarily
|
---|
| 122 | the case (e.g. the file manager starts a background process to
|
---|
| 123 | move files, so the source <em>must not</em> delete the files!)
|
---|
| 124 | <p> Note that on Windows the drag operation will spin a blocking modal
|
---|
| 125 | event loop that will not dispatch any QTimers.
|
---|
| 126 |
|
---|
| 127 | <p>Example: <a href="dirview-example.html#x1670">dirview/dirview.cpp</a>.
|
---|
| 128 | <h3 class=fn>bool <a name="drag-2"></a>QDragObject::drag ( <a href="qdragobject.html#DragMode-enum">DragMode</a> mode )<tt> [virtual protected]</tt>
|
---|
| 129 | </h3>
|
---|
| 130 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 131 | <p> Starts a drag operation using the contents of this object.
|
---|
| 132 | <p> At this point, the object becomes owned by Qt, not the
|
---|
| 133 | application. You should not delete the drag object or anything it
|
---|
| 134 | references. The actual transfer of data to the target application
|
---|
| 135 | will be done during future event processing - after that time the
|
---|
| 136 | drag object will be deleted.
|
---|
| 137 | <p> Returns TRUE if the dragged data was dragged as a <em>move</em>,
|
---|
| 138 | indicating that the caller should remove the original source of
|
---|
| 139 | the data (the drag object must continue to have a copy); otherwise
|
---|
| 140 | returns FALSE.
|
---|
| 141 | <p> The <em>mode</em> specifies the drag mode (see
|
---|
| 142 | <a href="#DragMode-enum">QDragObject::DragMode</a>.) Normally one of the simpler <a href="#drag">drag</a>(),
|
---|
| 143 | <a href="#dragMove">dragMove</a>(), or <a href="#dragCopy">dragCopy</a>() functions would be used instead.
|
---|
| 144 |
|
---|
| 145 | <h3 class=fn>void <a name="dragCopy"></a>QDragObject::dragCopy ()
|
---|
| 146 | </h3>
|
---|
| 147 | Starts a drag operation using the contents of this object, using
|
---|
| 148 | <a href="#DragMode-enum">DragCopy</a> mode. Be sure to read the constraints described in
|
---|
| 149 | <a href="#drag">drag</a>().
|
---|
| 150 | <p> <p>See also <a href="#drag">drag</a>(), <a href="#dragMove">dragMove</a>(), and <a href="#dragLink">dragLink</a>().
|
---|
| 151 |
|
---|
| 152 | <p>Example: <a href="simple_dd-example.html#x2818">iconview/simple_dd/main.cpp</a>.
|
---|
| 153 | <h3 class=fn>void <a name="dragLink"></a>QDragObject::dragLink ()
|
---|
| 154 | </h3>
|
---|
| 155 | Starts a drag operation using the contents of this object, using
|
---|
| 156 | <a href="#DragMode-enum">DragLink</a> mode. Be sure to read the constraints described in
|
---|
| 157 | <a href="#drag">drag</a>().
|
---|
| 158 | <p> <p>See also <a href="#drag">drag</a>(), <a href="#dragCopy">dragCopy</a>(), and <a href="#dragMove">dragMove</a>().
|
---|
| 159 |
|
---|
| 160 | <h3 class=fn>bool <a name="dragMove"></a>QDragObject::dragMove ()
|
---|
| 161 | </h3>
|
---|
| 162 | Starts a drag operation using the contents of this object, using
|
---|
| 163 | <a href="#DragMode-enum">DragMove</a> mode. Be sure to read the constraints described in
|
---|
| 164 | <a href="#drag">drag</a>().
|
---|
| 165 | <p> <p>See also <a href="#drag">drag</a>(), <a href="#dragCopy">dragCopy</a>(), and <a href="#dragLink">dragLink</a>().
|
---|
| 166 |
|
---|
| 167 | <h3 class=fn><a href="qpixmap.html">QPixmap</a> <a name="pixmap"></a>QDragObject::pixmap () const
|
---|
| 168 | </h3>
|
---|
| 169 | Returns the currently set pixmap (which <a href="qpixmap.html#isNull">isNull()</a> if none is set).
|
---|
| 170 |
|
---|
| 171 | <h3 class=fn><a href="qpoint.html">QPoint</a> <a name="pixmapHotSpot"></a>QDragObject::pixmapHotSpot () const
|
---|
| 172 | </h3>
|
---|
| 173 | Returns the currently set pixmap hotspot.
|
---|
| 174 |
|
---|
| 175 | <h3 class=fn>void <a name="setPixmap"></a>QDragObject::setPixmap ( <a href="qpixmap.html">QPixmap</a> pm, const <a href="qpoint.html">QPoint</a> & hotspot )<tt> [virtual]</tt>
|
---|
| 176 | </h3>
|
---|
| 177 | Set the pixmap <em>pm</em> to display while dragging the object. The
|
---|
| 178 | platform-specific implementation will use this where it can - so
|
---|
| 179 | provide a small masked pixmap, and do not assume that the user
|
---|
| 180 | will actually see it. For example, cursors on Windows 95 are of
|
---|
| 181 | limited size.
|
---|
| 182 | <p> The <em>hotspot</em> is the point on (or off) the pixmap that should be
|
---|
| 183 | under the cursor as it is dragged. It is relative to the top-left
|
---|
| 184 | pixel of the pixmap.
|
---|
| 185 | <p> <b>Warning:</b> We have seen problems with drag cursors on different
|
---|
| 186 | graphics hardware and driver software on Windows. Setting the
|
---|
| 187 | graphics acceleration in the display settings down one tick solved
|
---|
| 188 | the problems in all cases.
|
---|
| 189 |
|
---|
| 190 | <p>Example: <a href="fileiconview-example.html#x815">fileiconview/qfileiconview.cpp</a>.
|
---|
| 191 | <h3 class=fn>void <a name="setPixmap-2"></a>QDragObject::setPixmap ( <a href="qpixmap.html">QPixmap</a> pm )<tt> [virtual]</tt>
|
---|
| 192 | </h3>
|
---|
| 193 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 194 | <p> Uses a hotspot that positions the pixmap below and to the right of
|
---|
| 195 | the mouse pointer. This allows the user to clearly see the point
|
---|
| 196 | on the window which they are dragging the data onto.
|
---|
| 197 |
|
---|
| 198 | <h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="source"></a>QDragObject::source ()
|
---|
| 199 | </h3>
|
---|
| 200 | Returns a pointer to the drag source where this object originated.
|
---|
| 201 |
|
---|
| 202 | <h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="target"></a>QDragObject::target ()<tt> [static]</tt>
|
---|
| 203 | </h3>
|
---|
| 204 | After the drag completes, this function will return the <a href="qwidget.html">QWidget</a>
|
---|
| 205 | which received the drop, or 0 if the data was dropped on another
|
---|
| 206 | application.
|
---|
| 207 | <p> This can be useful for detecting the case where drag and drop is
|
---|
| 208 | to and from the same widget.
|
---|
| 209 |
|
---|
| 210 | <!-- eof -->
|
---|
| 211 | <hr><p>
|
---|
| 212 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 213 | Copyright © 1995-2007
|
---|
| 214 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 215 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 216 | <td>Copyright © 2007
|
---|
| 217 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 218 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 219 | </table></div></address></body>
|
---|
| 220 | </html>
|
---|