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