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/qdnd_x11.cpp:1565 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QDropEvent 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>QDropEvent Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QDropEvent class provides an event which is sent when a drag and drop is completed.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qevent-h.html">qevent.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qevent.html">QEvent</a> and <a href="qmimesource.html">QMimeSource</a>.
|
---|
38 | <p>Inherited by <a href="qdragmoveevent.html">QDragMoveEvent</a>.
|
---|
39 | <p><a href="qdropevent-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QDropEvent"><b>QDropEvent</b></a> ( const QPoint & pos, Type typ = Drop )</li>
|
---|
43 | <li class=fn>const QPoint & <a href="#pos"><b>pos</b></a> () const</li>
|
---|
44 | <li class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</li>
|
---|
45 | <li class=fn>void <a href="#accept"><b>accept</b></a> ( bool y = TRUE )</li>
|
---|
46 | <li class=fn>void <a href="#ignore"><b>ignore</b></a> ()</li>
|
---|
47 | <li class=fn>bool <a href="#isActionAccepted"><b>isActionAccepted</b></a> () const</li>
|
---|
48 | <li class=fn>void <a href="#acceptAction"><b>acceptAction</b></a> ( bool y = TRUE )</li>
|
---|
49 | <li class=fn>enum <a href="#Action-enum"><b>Action</b></a> { Copy, Link, Move, Private, UserAction = 100 }</li>
|
---|
50 | <li class=fn>void <a href="#setAction"><b>setAction</b></a> ( Action a )</li>
|
---|
51 | <li class=fn>Action <a href="#action"><b>action</b></a> () const</li>
|
---|
52 | <li class=fn>QWidget * <a href="#source"><b>source</b></a> () const</li>
|
---|
53 | <li class=fn>virtual const char * <a href="#format"><b>format</b></a> ( int n = 0 ) const</li>
|
---|
54 | <li class=fn>virtual QByteArray <a href="#encodedData"><b>encodedData</b></a> ( const char * format ) const</li>
|
---|
55 | <li class=fn>virtual bool <a href="#provides"><b>provides</b></a> ( const char * mimeType ) const</li>
|
---|
56 | <li class=fn>QByteArray data ( const char * f ) const <em>(obsolete)</em></li>
|
---|
57 | <li class=fn>void <a href="#setPoint"><b>setPoint</b></a> ( const QPoint & np )</li>
|
---|
58 | </ul>
|
---|
59 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 | <p> The QDropEvent class provides an event which is sent when a drag and drop is completed.
|
---|
65 | <p> When a widget <a href="qwidget.html#setAcceptDrops">accepts drop
|
---|
66 | events</a>, it will receive this event if it has accepted the
|
---|
67 | most recent <a href="qdragenterevent.html">QDragEnterEvent</a> or <a href="qdragmoveevent.html">QDragMoveEvent</a> sent to it.
|
---|
68 | <p> The widget should use <a href="#data">data</a>() to extract the data in an appropriate
|
---|
69 | format.
|
---|
70 | <p>See also <a href="draganddrop.html">Drag And Drop Classes</a> and <a href="events.html">Event Classes</a>.
|
---|
71 |
|
---|
72 | <hr><h2>Member Type Documentation</h2>
|
---|
73 | <h3 class=fn><a name="Action-enum"></a>QDropEvent::Action</h3>
|
---|
74 |
|
---|
75 | <p> This enum describes the action which a source requests that a
|
---|
76 | target perform with dropped data.
|
---|
77 | <ul>
|
---|
78 | <li><tt>QDropEvent::Copy</tt> - The default action. The source simply uses the data
|
---|
79 | provided in the operation.
|
---|
80 | <li><tt>QDropEvent::Link</tt> - The source should somehow create a link to the
|
---|
81 | location specified by the data.
|
---|
82 | <li><tt>QDropEvent::Move</tt> - The source should somehow move the object from the
|
---|
83 | location specified by the data to a new location.
|
---|
84 | <li><tt>QDropEvent::Private</tt> - The target has special knowledge of the MIME type,
|
---|
85 | which the source should respond to in a similar way to
|
---|
86 | a Copy.
|
---|
87 | <li><tt>QDropEvent::UserAction</tt> - The source and target can co-operate using
|
---|
88 | special actions. This feature is not currently
|
---|
89 | supported.
|
---|
90 | </ul><p> The Link and Move actions only makes sense if the data is a
|
---|
91 | reference, for example, text/uri-list file lists (see <a href="quridrag.html">QUriDrag</a>).
|
---|
92 |
|
---|
93 | <hr><h2>Member Function Documentation</h2>
|
---|
94 | <h3 class=fn><a name="QDropEvent"></a>QDropEvent::QDropEvent ( const <a href="qpoint.html">QPoint</a> & pos, <a href="qevent.html#Type-enum">Type</a> typ = Drop )
|
---|
95 | </h3>
|
---|
96 |
|
---|
97 | <p> Constructs a drop event that drops a drop of type <em>typ</em> on point
|
---|
98 | <em>pos</em>.
|
---|
99 |
|
---|
100 | <h3 class=fn>void <a name="accept"></a>QDropEvent::accept ( bool y = TRUE )
|
---|
101 | </h3>
|
---|
102 |
|
---|
103 | <p> Call this function to indicate whether the event provided data
|
---|
104 | which your widget processed. Set <em>y</em> to TRUE (the default) if
|
---|
105 | your widget could process the data, otherwise set <em>y</em> to FALSE.
|
---|
106 | To get the data, use <a href="#encodedData">encodedData</a>(), or preferably, the decode()
|
---|
107 | methods of existing <a href="qdragobject.html">QDragObject</a> subclasses, such as
|
---|
108 | <a href="qtextdrag.html#decode">QTextDrag::decode</a>(), or your own subclasses.
|
---|
109 | <p> <p>See also <a href="#acceptAction">acceptAction</a>().
|
---|
110 |
|
---|
111 | <p>Example: <a href="simple_dd-example.html#x2819">iconview/simple_dd/main.cpp</a>.
|
---|
112 | <h3 class=fn>void <a name="acceptAction"></a>QDropEvent::acceptAction ( bool y = TRUE )
|
---|
113 | </h3>
|
---|
114 |
|
---|
115 | <p> Call this to indicate that the action described by <a href="#action">action</a>() is
|
---|
116 | accepted (i.e. if <em>y</em> is TRUE, which is the default), not merely
|
---|
117 | the default copy action. If you call <a href="#acceptAction">acceptAction</a>(TRUE), there is
|
---|
118 | no need to also call <a href="#accept">accept</a>(TRUE).
|
---|
119 |
|
---|
120 | <p>Examples: <a href="dirview-example.html#x1671">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x816">fileiconview/qfileiconview.cpp</a>.
|
---|
121 | <h3 class=fn><a href="qdropevent.html#Action-enum">Action</a> <a name="action"></a>QDropEvent::action () const
|
---|
122 | </h3>
|
---|
123 |
|
---|
124 | <p> Returns the Action which the target is requesting to be performed
|
---|
125 | with the data. If your application understands the action and can
|
---|
126 | process the supplied data, call <a href="#acceptAction">acceptAction</a>(); if your
|
---|
127 | application can process the supplied data but can only perform the
|
---|
128 | Copy action, call <a href="#accept">accept</a>().
|
---|
129 |
|
---|
130 | <p>Examples: <a href="dirview-example.html#x1672">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x817">fileiconview/qfileiconview.cpp</a>.
|
---|
131 | <h3 class=fn><a href="qbytearray.html">QByteArray</a> <a name="data"></a>QDropEvent::data ( const char * f ) const
|
---|
132 | </h3>
|
---|
133 |
|
---|
134 | <p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
135 | <p> Use <a href="#encodedData">QDropEvent::encodedData</a>().
|
---|
136 |
|
---|
137 | <h3 class=fn><a href="qbytearray.html">QByteArray</a> <a name="encodedData"></a>QDropEvent::encodedData ( const char * format ) const<tt> [virtual]</tt>
|
---|
138 | </h3>
|
---|
139 | Returns a byte array containing the drag's data, in <em>format</em>.
|
---|
140 | <p> <a href="#data">data</a>() normally needs to get the data from the drag source, which
|
---|
141 | is potentially very slow, so it's advisable to call this function
|
---|
142 | only if you're sure that you will need the data in <em>format</em>.
|
---|
143 | <p> The resulting data will have a size of 0 if the format was not
|
---|
144 | available.
|
---|
145 | <p> <p>See also <a href="#format">format</a>() and <a href="qmemarray.html#size">QByteArray::size</a>().
|
---|
146 |
|
---|
147 | <p>Reimplemented from <a href="qmimesource.html#encodedData">QMimeSource</a>.
|
---|
148 | <h3 class=fn>const char * <a name="format"></a>QDropEvent::format ( int n = 0 ) const<tt> [virtual]</tt>
|
---|
149 | </h3>
|
---|
150 | Returns a string describing one of the available data types for
|
---|
151 | 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
|
---|
152 | types, <a href="#format">format</a>() returns 0.
|
---|
153 | <p> This function is provided mainly for debugging. Most drop targets
|
---|
154 | will use <a href="#provides">provides</a>().
|
---|
155 | <p> <p>See also <a href="#data">data</a>() and <a href="#provides">provides</a>().
|
---|
156 |
|
---|
157 | <p>Example: <a href="iconview-example.html#x1454">iconview/main.cpp</a>.
|
---|
158 | <p>Reimplemented from <a href="qmimesource.html#format">QMimeSource</a>.
|
---|
159 | <h3 class=fn>void <a name="ignore"></a>QDropEvent::ignore ()
|
---|
160 | </h3>
|
---|
161 |
|
---|
162 | <p> The opposite of <a href="#accept">accept</a>(), i.e. you have ignored the drop event.
|
---|
163 |
|
---|
164 | <p>Example: <a href="fileiconview-example.html#x818">fileiconview/qfileiconview.cpp</a>.
|
---|
165 | <h3 class=fn>bool <a name="isAccepted"></a>QDropEvent::isAccepted () const
|
---|
166 | </h3>
|
---|
167 |
|
---|
168 | <p> Returns TRUE if the drop target accepts the event; otherwise
|
---|
169 | returns FALSE.
|
---|
170 |
|
---|
171 | <h3 class=fn>bool <a name="isActionAccepted"></a>QDropEvent::isActionAccepted () const
|
---|
172 | </h3>
|
---|
173 |
|
---|
174 | <p> Returns TRUE if the drop action was accepted by the drop site;
|
---|
175 | otherwise returns FALSE.
|
---|
176 |
|
---|
177 | <h3 class=fn>const <a href="qpoint.html">QPoint</a> & <a name="pos"></a>QDropEvent::pos () const
|
---|
178 | </h3>
|
---|
179 |
|
---|
180 | <p> Returns the position where the drop was made.
|
---|
181 |
|
---|
182 | <p>Example: <a href="dirview-example.html#x1673">dirview/dirview.cpp</a>.
|
---|
183 | <h3 class=fn>bool <a name="provides"></a>QDropEvent::provides ( const char * mimeType ) const<tt> [virtual]</tt>
|
---|
184 | </h3>
|
---|
185 | Returns TRUE if this event provides format <em>mimeType</em>; otherwise
|
---|
186 | returns FALSE.
|
---|
187 | <p> <p>See also <a href="#data">data</a>().
|
---|
188 |
|
---|
189 | <p>Example: <a href="fileiconview-example.html#x819">fileiconview/qfileiconview.cpp</a>.
|
---|
190 | <p>Reimplemented from <a href="qmimesource.html#provides">QMimeSource</a>.
|
---|
191 | <h3 class=fn>void <a name="setAction"></a>QDropEvent::setAction ( <a href="qdropevent.html#Action-enum">Action</a> a )
|
---|
192 | </h3>
|
---|
193 |
|
---|
194 | <p> Sets the action to <em>a</em>. This is used internally, you should not
|
---|
195 | need to call this in your code: the <em>source</em> decides the action,
|
---|
196 | not the target.
|
---|
197 |
|
---|
198 | <h3 class=fn>void <a name="setPoint"></a>QDropEvent::setPoint ( const <a href="qpoint.html">QPoint</a> & np )
|
---|
199 | </h3>
|
---|
200 |
|
---|
201 | <p> Sets the drop to happen at point <em>np</em>. You do not normally need
|
---|
202 | to use this as it will be set internally before your widget
|
---|
203 | receives the drop event.
|
---|
204 |
|
---|
205 | <h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="source"></a>QDropEvent::source () const
|
---|
206 | </h3>
|
---|
207 | If the source of the drag operation is a widget in this
|
---|
208 | application, this function returns that source, otherwise it
|
---|
209 | returns 0. The source of the operation is the first parameter to
|
---|
210 | drag object subclasses.
|
---|
211 | <p> This is useful if your widget needs special behavior when dragging
|
---|
212 | to itself, etc.
|
---|
213 | <p> See <a href="qdragobject.html#QDragObject">QDragObject::QDragObject</a>() and subclasses.
|
---|
214 |
|
---|
215 | <!-- eof -->
|
---|
216 | <hr><p>
|
---|
217 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
218 | Copyright © 1995-2007
|
---|
219 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
220 | <table width=100% cellspacing=0 border=0><tr>
|
---|
221 | <td>Copyright © 2007
|
---|
222 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
223 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
224 | </table></div></address></body>
|
---|
225 | </html>
|
---|