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
221
222
223
224
225
|
<!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/qdnd_x11.cpp:1565 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQDropEvent 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>TQDropEvent Class Reference</h1>
<p>The TQDropEvent class provides an event which is sent when a drag and drop is completed.
<a href="#details">More...</a>
<p><tt>#include <<a href="qevent-h.html">ntqevent.h</a>></tt>
<p>Inherits <a href="ntqevent.html">TQEvent</a> and <a href="qmimesource.html">TQMimeSource</a>.
<p>Inherited by <a href="qdragmoveevent.html">TQDragMoveEvent</a>.
<p><a href="qdropevent-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQDropEvent"><b>TQDropEvent</b></a> ( const TQPoint & pos, Type typ = Drop )</li>
<li class=fn>const TQPoint & <a href="#pos"><b>pos</b></a> () const</li>
<li class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</li>
<li class=fn>void <a href="#accept"><b>accept</b></a> ( bool y = TRUE )</li>
<li class=fn>void <a href="#ignore"><b>ignore</b></a> ()</li>
<li class=fn>bool <a href="#isActionAccepted"><b>isActionAccepted</b></a> () const</li>
<li class=fn>void <a href="#acceptAction"><b>acceptAction</b></a> ( bool y = TRUE )</li>
<li class=fn>enum <a href="#Action-enum"><b>Action</b></a> { Copy, Link, Move, Private, UserAction = 100 }</li>
<li class=fn>void <a href="#setAction"><b>setAction</b></a> ( Action a )</li>
<li class=fn>Action <a href="#action"><b>action</b></a> () const</li>
<li class=fn>TQWidget * <a href="#source"><b>source</b></a> () const</li>
<li class=fn>virtual const char * <a href="#format"><b>format</b></a> ( int n = 0 ) const</li>
<li class=fn>virtual TQByteArray <a href="#encodedData"><b>encodedData</b></a> ( const char * format ) const</li>
<li class=fn>virtual bool <a href="#provides"><b>provides</b></a> ( const char * mimeType ) const</li>
<li class=fn>TQByteArray data ( const char * f ) const <em>(obsolete)</em></li>
<li class=fn>void <a href="#setPoint"><b>setPoint</b></a> ( const TQPoint & np )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The TQDropEvent class provides an event which is sent when a drag and drop is completed.
<p> When a widget <a href="tqwidget.html#setAcceptDrops">accepts drop
events</a>, it will receive this event if it has accepted the
most recent <a href="qdragenterevent.html">TQDragEnterEvent</a> or <a href="qdragmoveevent.html">TQDragMoveEvent</a> sent to it.
<p> The widget should use <a href="#data">data</a>() to extract the data in an appropriate
format.
<p>See also <a href="draganddrop.html">Drag And Drop Classes</a> and <a href="events.html">Event Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Action-enum"></a>TQDropEvent::Action</h3>
<p> This enum describes the action which a source requests that a
target perform with dropped data.
<ul>
<li><tt>TQDropEvent::Copy</tt> - The default action. The source simply uses the data
provided in the operation.
<li><tt>TQDropEvent::Link</tt> - The source should somehow create a link to the
location specified by the data.
<li><tt>TQDropEvent::Move</tt> - The source should somehow move the object from the
location specified by the data to a new location.
<li><tt>TQDropEvent::Private</tt> - The target has special knowledge of the MIME type,
which the source should respond to in a similar way to
a Copy.
<li><tt>TQDropEvent::UserAction</tt> - The source and target can co-operate using
special actions. This feature is not currently
supported.
</ul><p> The Link and Move actions only makes sense if the data is a
reference, for example, text/uri-list file lists (see <a href="quridrag.html">TQUriDrag</a>).
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQDropEvent"></a>TQDropEvent::TQDropEvent ( const <a href="ntqpoint.html">TQPoint</a> & pos, <a href="ntqevent.html#Type-enum">Type</a> typ = Drop )
</h3>
<p> Constructs a drop event that drops a drop of type <em>typ</em> on point
<em>pos</em>.
<h3 class=fn>void <a name="accept"></a>TQDropEvent::accept ( bool y = TRUE )
</h3>
<p> Call this function to indicate whether the event provided data
which your widget processed. Set <em>y</em> to TRUE (the default) if
your widget could process the data, otherwise set <em>y</em> to FALSE.
To get the data, use <a href="#encodedData">encodedData</a>(), or preferably, the decode()
methods of existing <a href="ntqdragobject.html">TQDragObject</a> subclasses, such as
<a href="tqtextdrag.html#decode">TQTextDrag::decode</a>(), or your own subclasses.
<p> <p>See also <a href="#acceptAction">acceptAction</a>().
<p>Example: <a href="simple_dd-example.html#x2819">iconview/simple_dd/main.cpp</a>.
<h3 class=fn>void <a name="acceptAction"></a>TQDropEvent::acceptAction ( bool y = TRUE )
</h3>
<p> Call this to indicate that the action described by <a href="#action">action</a>() is
accepted (i.e. if <em>y</em> is TRUE, which is the default), not merely
the default copy action. If you call <a href="#acceptAction">acceptAction</a>(TRUE), there is
no need to also call <a href="#accept">accept</a>(TRUE).
<p>Examples: <a href="dirview-example.html#x1671">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x816">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn><a href="qdropevent.html#Action-enum">Action</a> <a name="action"></a>TQDropEvent::action () const
</h3>
<p> Returns the Action which the target is requesting to be performed
with the data. If your application understands the action and can
process the supplied data, call <a href="#acceptAction">acceptAction</a>(); if your
application can process the supplied data but can only perform the
Copy action, call <a href="#accept">accept</a>().
<p>Examples: <a href="dirview-example.html#x1672">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x817">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn><a href="qbytearray.html">TQByteArray</a> <a name="data"></a>TQDropEvent::data ( const char * f ) const
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Use <a href="#encodedData">TQDropEvent::encodedData</a>().
<h3 class=fn><a href="qbytearray.html">TQByteArray</a> <a name="encodedData"></a>TQDropEvent::encodedData ( const char * format ) const<tt> [virtual]</tt>
</h3>
Returns a byte array containing the drag's data, in <em>format</em>.
<p> <a href="#data">data</a>() normally needs to get the data from the drag source, which
is potentially very slow, so it's advisable to call this function
only if you're sure that you will need the data in <em>format</em>.
<p> The resulting data will have a size of 0 if the format was not
available.
<p> <p>See also <a href="#format">format</a>() and <a href="ntqmemarray.html#size">TQByteArray::size</a>().
<p>Reimplemented from <a href="qmimesource.html#encodedData">TQMimeSource</a>.
<h3 class=fn>const char * <a name="format"></a>TQDropEvent::format ( int n = 0 ) const<tt> [virtual]</tt>
</h3>
Returns a string describing one of the available data types for
this drag. Common examples are "text/plain" and "image/gif". If <em>n</em> is less than zero or greater than the number of available data
types, <a href="#format">format</a>() returns 0.
<p> This function is provided mainly for debugging. Most drop targets
will use <a href="#provides">provides</a>().
<p> <p>See also <a href="#data">data</a>() and <a href="#provides">provides</a>().
<p>Example: <a href="iconview-example.html#x1454">iconview/main.cpp</a>.
<p>Reimplemented from <a href="qmimesource.html#format">TQMimeSource</a>.
<h3 class=fn>void <a name="ignore"></a>TQDropEvent::ignore ()
</h3>
<p> The opposite of <a href="#accept">accept</a>(), i.e. you have ignored the drop event.
<p>Example: <a href="fileiconview-example.html#x818">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn>bool <a name="isAccepted"></a>TQDropEvent::isAccepted () const
</h3>
<p> Returns TRUE if the drop target accepts the event; otherwise
returns FALSE.
<h3 class=fn>bool <a name="isActionAccepted"></a>TQDropEvent::isActionAccepted () const
</h3>
<p> Returns TRUE if the drop action was accepted by the drop site;
otherwise returns FALSE.
<h3 class=fn>const <a href="ntqpoint.html">TQPoint</a> & <a name="pos"></a>TQDropEvent::pos () const
</h3>
<p> Returns the position where the drop was made.
<p>Example: <a href="dirview-example.html#x1673">dirview/dirview.cpp</a>.
<h3 class=fn>bool <a name="provides"></a>TQDropEvent::provides ( const char * mimeType ) const<tt> [virtual]</tt>
</h3>
Returns TRUE if this event provides format <em>mimeType</em>; otherwise
returns FALSE.
<p> <p>See also <a href="#data">data</a>().
<p>Example: <a href="fileiconview-example.html#x819">fileiconview/qfileiconview.cpp</a>.
<p>Reimplemented from <a href="qmimesource.html#provides">TQMimeSource</a>.
<h3 class=fn>void <a name="setAction"></a>TQDropEvent::setAction ( <a href="qdropevent.html#Action-enum">Action</a> a )
</h3>
<p> Sets the action to <em>a</em>. This is used internally, you should not
need to call this in your code: the <em>source</em> decides the action,
not the target.
<h3 class=fn>void <a name="setPoint"></a>TQDropEvent::setPoint ( const <a href="ntqpoint.html">TQPoint</a> & np )
</h3>
<p> Sets the drop to happen at point <em>np</em>. You do not normally need
to use this as it will be set internally before your widget
receives the drop event.
<h3 class=fn><a href="tqwidget.html">TQWidget</a> * <a name="source"></a>TQDropEvent::source () const
</h3>
If the source of the drag operation is a widget in this
application, this function returns that source, otherwise it
returns 0. The source of the operation is the first parameter to
drag object subclasses.
<p> This is useful if your widget needs special behavior when dragging
to itself, etc.
<p> See <a href="ntqdragobject.html#TQDragObject">TQDragObject::TQDragObject</a>() and subclasses.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>
|