1QDropEvent(3qt)                                                QDropEvent(3qt)
2
3
4

NAME

6       QDropEvent - Event which is sent when a drag and drop is completed
7

SYNOPSIS

9       #include <qevent.h>
10
11       Inherits QEvent and QMimeSource.
12
13       Inherited by QDragMoveEvent.
14
15   Public Members
16       QDropEvent ( const QPoint & pos, Type typ = Drop )
17       const QPoint & pos () const
18       bool isAccepted () const
19       void accept ( bool y = TRUE )
20       void ignore ()
21       bool isActionAccepted () const
22       void acceptAction ( bool y = TRUE )
23       enum Action { Copy, Link, Move, Private, UserAction = 100 }
24       void setAction ( Action a )
25       Action action () const
26       QWidget * source () const
27       virtual const char * format ( int n = 0 ) const
28       virtual QByteArray encodedData ( const char * format ) const
29       virtual bool provides ( const char * mimeType ) const
30       QByteArray data ( const char * f ) const  (obsolete)
31       void setPoint ( const QPoint & np )
32

DESCRIPTION

34       The QDropEvent class provides an event which is sent when a drag and
35       drop is completed.
36
37       When a widget accepts drop events, it will receive this event if it has
38       accepted the most recent QDragEnterEvent or QDragMoveEvent sent to it.
39
40       The widget should use data() to extract the data in an appropriate
41       format.
42
43       See also Drag And Drop Classes and Event Classes.
44
45   Member Type Documentation

QDropEvent::Action

47       This enum describes the action which a source requests that a target
48       perform with dropped data.
49
50       QDropEvent::Copy - The default action. The source simply uses the data
51       provided in the operation.
52
53       QDropEvent::Link - The source should somehow create a link to the
54       location specified by the data.
55
56       QDropEvent::Move - The source should somehow move the object from the
57       location specified by the data to a new location.
58
59       QDropEvent::Private - The target has special knowledge of the MIME
60       type, which the source should respond to in a similar way to a Copy.
61
62       QDropEvent::UserAction - The source and target can co-operate using
63       special actions. This feature is not currently supported.
64
65       The Link and Move actions only makes sense if the data is a reference,
66       for example, text/uri-list file lists (see QUriDrag).
67

MEMBER FUNCTION DOCUMENTATION

QDropEvent::QDropEvent ( const QPoint & pos, Type typ = Drop )

70       Constructs a drop event that drops a drop of type typ on point pos.
71

void QDropEvent::accept ( bool y = TRUE )

73       Call this function to indicate whether the event provided data which
74       your widget processed. Set y to TRUE (the default) if your widget could
75       process the data, otherwise set y to FALSE. To get the data, use
76       encodedData(), or preferably, the decode() methods of existing
77       QDragObject subclasses, such as QTextDrag::decode(), or your own
78       subclasses.
79
80       See also acceptAction().
81
82       Example: iconview/simple_dd/main.cpp.
83

void QDropEvent::acceptAction ( bool y = TRUE )

85       Call this to indicate that the action described by action() is accepted
86       (i.e. if y is TRUE, which is the default), not merely the default copy
87       action. If you call acceptAction(TRUE), there is no need to also call
88       accept(TRUE).
89
90       Examples:
91

Action QDropEvent::action () const

93       Returns the Action which the target is requesting to be performed with
94       the data. If your application understands the action and can process
95       the supplied data, call acceptAction(); if your application can process
96       the supplied data but can only perform the Copy action, call accept().
97
98       Examples:
99

QByteArray QDropEvent::data ( const char * f ) const

101       This function is obsolete. It is provided to keep old source working.
102       We strongly advise against using it in new code.
103
104       Use QDropEvent::encodedData().
105

QByteArray QDropEvent::encodedData ( const char * format ) const [virtual]

107       Returns a byte array containing the drag's data, in format.
108
109       data() normally needs to get the data from the drag source, which is
110       potentially very slow, so it's advisable to call this function only if
111       you're sure that you will need the data in format.
112
113       The resulting data will have a size of 0 if the format was not
114       available.
115
116       See also format() and QByteArray::size().
117
118       Reimplemented from QMimeSource.
119

const char * QDropEvent::format ( int n = 0 ) const [virtual]

121       Returns a string describing one of the available data types for this
122       drag. Common examples are "text/plain" and "image/gif". If n is less
123       than zero or greater than the number of available data types, format()
124       returns 0.
125
126       This function is provided mainly for debugging. Most drop targets will
127       use provides().
128
129       See also data() and provides().
130
131       Example: iconview/main.cpp.
132
133       Reimplemented from QMimeSource.
134

void QDropEvent::ignore ()

136       The opposite of accept(), i.e. you have ignored the drop event.
137
138       Example: fileiconview/qfileiconview.cpp.
139

bool QDropEvent::isAccepted () const

141       Returns TRUE if the drop target accepts the event; otherwise returns
142       FALSE.
143

bool QDropEvent::isActionAccepted () const

145       Returns TRUE if the drop action was accepted by the drop site;
146       otherwise returns FALSE.
147

const QPoint & QDropEvent::pos () const

149       Returns the position where the drop was made.
150
151       Example: dirview/dirview.cpp.
152

bool QDropEvent::provides ( const char * mimeType ) const [virtual]

154       Returns TRUE if this event provides format mimeType; otherwise returns
155       FALSE.
156
157       See also data().
158
159       Example: fileiconview/qfileiconview.cpp.
160
161       Reimplemented from QMimeSource.
162

void QDropEvent::setAction ( Action a )

164       Sets the action to a. This is used internally, you should not need to
165       call this in your code: the source decides the action, not the target.
166

void QDropEvent::setPoint ( const QPoint & np )

168       Sets the drop to happen at point np. You do not normally need to use
169       this as it will be set internally before your widget receives the drop
170       event.
171

QWidget * QDropEvent::source () const

173       If the source of the drag operation is a widget in this application,
174       this function returns that source, otherwise it returns 0. The source
175       of the operation is the first parameter to drag object subclasses.
176
177       This is useful if your widget needs special behavior when dragging to
178       itself, etc.
179
180       See QDragObject::QDragObject() and subclasses.
181
182

SEE ALSO

184       http://doc.trolltech.com/qdropevent.html
185       http://www.trolltech.com/faq/tech.html
186
188       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
189       license file included in the distribution for a complete license
190       statement.
191

AUTHOR

193       Generated automatically from the source code.
194

BUGS

196       If you find a bug in Qt, please report it as described in
197       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
198       help you. Thank you.
199
200       The definitive Qt documentation is provided in HTML format; it is
201       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
202       web browser. This man page is provided as a convenience for those users
203       who prefer man pages, although this format is not officially supported
204       by Trolltech.
205
206       If you find errors in this manual page, please report them to qt-
207       bugs@trolltech.com.  Please include the name of the manual page
208       (qdropevent.3qt) and the Qt version (3.3.8).
209
210
211
212Trolltech AS                    2 February 2007                QDropEvent(3qt)
Impressum