File: qdropevent.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (171 lines) | stat: -rw-r--r-- 10,848 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QDropEvent Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">

<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>

<h1 align=center>QDropEvent Class Reference</h1><br clear="all">
<p>
Event sent when a drag-and-drop is completed.
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qevent-h.html">qevent.h</a>&gt;</code>
<p>
Inherits <a href="qevent.html">QEvent</a> and <a href="qmimesource.html">QMimeSource</a>.
<p>Inherited by <a href="qdragmoveevent.html">QDragMoveEvent</a>.
<p><a href="qdropevent-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#d75b5c"><b>QDropEvent</b></a>(constQPoint&amp;pos, Typetyp=Drop)</div>
<li><div class="fn">constQPoint&amp;<a href="#b3ba77"><b>pos</b></a>()const</div>
<li><div class="fn">bool<a href="#2a377d"><b>isAccepted</b></a>()const</div>
<li><div class="fn">void<a href="#e7a50f"><b>ignore</b></a>()</div>
<li><div class="fn">bool<a href="#fbdc30"><b>isActionAccepted</b></a>()const</div>
<li><div class="fn">void<a href="#d37a0e"><b>acceptAction</b></a>(booly=TRUE)</div>
<li><div class="fn">enum<a href="#Action"><b>Action</b></a>{Copy, Link, Move, Private, UserAction=100}</div>
<li><div class="fn">void<a href="#5ab251"><b>setAction</b></a>(Actiona)</div>
<li><div class="fn">Action<a href="#d9f8b7"><b>action</b></a>()const</div>
<li><div class="fn">QWidget*<a href="#00626c"><b>source</b></a>()const</div>
<li><div class="fn">virtualconstchar*<a href="#d81a92"><b>format</b></a>(intn=0)const</div>
<li><div class="fn">virtualQByteArray<a href="#8869ad"><b>encodedData</b></a>(constchar*)const</div>
<li><div class="fn">virtualbool<a href="#e9bf16"><b>provides</b></a>(constchar*)const</div>
<li><div class="fn">QByteArraydata(constchar*f)const<em>(obsolete)</em></div>
<li><div class="fn">void<a href="#7c2622"><b>setPoint</b></a>(constQPoint&amp;np)</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
Event sent when a drag-and-drop is completed.
<p>
When a widget <a href="qwidget.html#8169cb">accepts drop events</a>,
it will receive this event if it has accepted the most recent
<a href="qdragenterevent.html">QDragEnterEvent</a> or <a href="qdragmoveevent.html">QDragMoveEvent</a> sent to it.
<p>The widget should use <a href="#8ebecf">data</a>() to extract data in an
appropriate format.
<p>Examples:
 <a href="iconview-main-cpp.html#QDropEvent">iconview/main.cpp</a>
 <a href="desktop-desktop-cpp.html#QDropEvent">desktop/desktop.cpp</a>

<hr><h2>Member Type Documentation</h2>
<h3 class="fn"><a name="Action">QDropEvent::Action</a></h3>
This type describes the action which a source requests that a target
perform with dropped data.  The values are:
<p><ul>
<li><code>Copy</code> - the default action.  The source simply users the data
provided in the operation.
<li><code>Link.</code> The source should somehow create a link to the location
specified by the data.
<li><code>Move.</code>  The source should somehow move the object from the location
specified by the data to a new location.
<li><code>Private.</code>  The target has special knowledge of the MIME type, which
the source should respond to similar to a Copy.
<li><code>UserAction.</code>  The source and target can co-operate using special
actions.  This feature is not supported in Qt at this time.
</ul>
<p>The Link and Move actions only makes sense if the data is
a reference, such as text/uri-list file lists (see <a href="quridrag.html">QUriDrag</a>).
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="d75b5c"></a>QDropEvent::QDropEvent(const<a href="qpoint.html">QPoint</a>&amp;pos, <a href="qevent.html#Type">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="da0c5a"></a>QDropEvent::accept(booly=TRUE=TRUE)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Call this to indicate whether the event provided data which your
widget processed.  To get the data, use <a href="#8869ad">encodedData</a>(), or
preferably, the decode() methods of existing <a href="qdragobject.html">QDragObject</a> subclasses,
such as <a href="qtextdrag.html#b02128">QTextDrag::decode</a>(), or your own subclasses.<p><b>Warning:</b> To accept or reject the drop, call <a href="#d37a0e">acceptAction</a>(), not this
function.  This function indicates whether you processed the event
at all.
<p>See also  <a href="#d37a0e">acceptAction</a>().
<p>Examples:
 <a href="desktop-desktop-cpp.html#accept">desktop/desktop.cpp</a>
<h3 class="fn">void<a name="d37a0e"></a>QDropEvent::acceptAction(booly=TRUE=TRUE)</h3>
<p>Call this to indicate that the action described by <a href="#d9f8b7">action</a>() is accepted,
not merely the default copy action.  If you call acceptAction(TRUE),
there is no need to also call <a href="#da0c5a">accept</a>(TRUE).
<h3 class="fn"><a href="qdropevent.html#Action">Action</a><a name="d9f8b7"></a>QDropEvent::action()const</h3>
<p>Returns the <a href="#Action">Action</a> which the target is requesting be performed with
the data.  If your application understands the action and can
process the supplied data, call <a href="#d37a0e">acceptAction</a>(); if your application
can process the supplied data but can only perform the Copy action,
call <a href="#da0c5a">accept</a>().
<h3 class="fn"><a href="qbytearray.html">QByteArray</a><a name="8ebecf"></a>QDropEvent::data(constchar*f)const</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt.  We strongly advise against using it in new code.<p>
<p>Use <a href="#8869ad">QDropEvent::encodedData</a>().
<h3 class="fn"><a href="qbytearray.html">QByteArray</a><a name="8869ad"></a>QDropEvent::encodedData(constchar*format)const <code>[virtual]</code></h3>
<p>Returns a byte array containing the payload data of this drag, in
<em>format.</em>
<p><a href="#8ebecf">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>See also  <a href="#d81a92">format</a>() and <a href="qbytearray.html#3d2edb">QByteArray::size</a>().
<p>Reimplemented from <a href="qmimesource.html#81afea">QMimeSource.</a>
<h3 class="fn">constchar*<a name="d81a92"></a>QDropEvent::format(int<a href="n.html">n</a>=0)const <code>[virtual]</code></h3>
<p>Returns a string describing one of the available data types for
this drag.  Common examples are "text/plain" and "image/gif".  If <em><a href="n.html">n</a></em> is less than zero or greater than the number of available data
types, format() returns 0.
<p>This function is provided mainly for debugging.  Most drop targets
will use <a href="#e9bf16">provides</a>().
<p>See also  <a href="#8ebecf">data</a>() and <a href="#e9bf16">provides</a>().
<p>Examples:
 <a href="iconview-main-cpp.html#format">iconview/main.cpp</a>
<p>Reimplemented from <a href="qmimesource.html#17ce96">QMimeSource.</a>
<h3 class="fn">void<a name="e7a50f"></a>QDropEvent::ignore()</h3>
<p>The opposite of <a href="#da0c5a">accept</a>().
<h3 class="fn">bool<a name="2a377d"></a>QDropEvent::isAccepted()const</h3>
<p>Returns TRUE if the drop target accepts the event.
<h3 class="fn">bool<a name="fbdc30"></a>QDropEvent::isActionAccepted()const</h3>
<p>Returns TRUE if the drop action was accepted by the drop site, and
FALSE if not.
<h3 class="fn">const<a href="qpoint.html">QPoint</a>&amp;<a name="b3ba77"></a>QDropEvent::pos()const</h3>
<p>Returns the position where the drop was made.
<h3 class="fn">bool<a name="e9bf16"></a>QDropEvent::provides(constchar*mimeType)const <code>[virtual]</code></h3>
<p>Returns TRUE if this event provides format <em>mimeType</em> or
FALSE if it does not.
<p>See also  <a href="#8ebecf">data</a>().
<p>Reimplemented from <a href="qmimesource.html#bf7439">QMimeSource.</a>
<h3 class="fn">void<a name="5ab251"></a>QDropEvent::setAction(<a href="qdropevent.html#Action">Action</a>a)</h3>
<p>Sets the action.  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="7c2622"></a>QDropEvent::setPoint(const<a href="qpoint.html">QPoint</a>&amp;np)</h3>
<p>Sets the drop to happen at <em>np.</em>  You do normally not need to use
this as it will be set internally before your widget receives the
drop event.
<h3 class="fn"><a href="qwidget.html">QWidget</a>*<a name="00626c"></a>QDropEvent::source()const</h3>
<p>If the source of the drag operation is a widget in this application,
this function returns that source, otherwise 0.  The source of the
operation is the first parameter to to drag object subclass.
<p>This is useful if your widget needs special behavior when dragging
to itself, etc.
<p>See <a href="qdragobject.html#ecea74">QDragObject::QDragObject</a>() and subclasses.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright &copy; 1995-2001
<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  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>