⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qdropevent.html

📁 QT 下载资料仅供参考
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/kernel/qdnd_x11.cpp:1501 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>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: #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&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;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>QDropEvent Class Reference</h1><p>The QDropEvent class provides an event which is sent when a drag and drop is completed.<a href="#details">More...</a><p><tt>#include &lt;<a href="qevent-h.html">qevent.h</a>&gt;</tt><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="#QDropEvent"><b>QDropEvent</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, Type&nbsp;typ = Drop )</div></li><li><div class=fn>const QPoint &amp; <a href="#pos"><b>pos</b></a> () const</div></li><li><div class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</div></li><li><div class=fn>void <a href="#accept"><b>accept</b></a> ( bool&nbsp;y = TRUE )</div></li><li><div class=fn>void <a href="#ignore"><b>ignore</b></a> ()</div></li><li><div class=fn>bool <a href="#isActionAccepted"><b>isActionAccepted</b></a> () const</div></li><li><div class=fn>void <a href="#acceptAction"><b>acceptAction</b></a> ( bool&nbsp;y = TRUE )</div></li><li><div class=fn>enum <a href="#Action-enum"><b>Action</b></a> { Copy, Link, Move, Private, UserAction = 100 }</div></li><li><div class=fn>void <a href="#setAction"><b>setAction</b></a> ( Action&nbsp;a )</div></li><li><div class=fn>Action <a href="#action"><b>action</b></a> () const</div></li><li><div class=fn>QWidget * <a href="#source"><b>source</b></a> () const</div></li><li><div class=fn>virtual const char * <a href="#format"><b>format</b></a> ( int&nbsp;n = 0 ) const</div></li><li><div class=fn>virtual QByteArray <a href="#encodedData"><b>encodedData</b></a> ( const&nbsp;char&nbsp;*&nbsp;format ) const</div></li><li><div class=fn>virtual bool <a href="#provides"><b>provides</b></a> ( const&nbsp;char&nbsp;*&nbsp;mimeType ) const</div></li><li><div class=fn>QByteArray data ( const&nbsp;char&nbsp;*&nbsp;f ) const &nbsp;<em>(obsolete)</em></div></li><li><div class=fn>void <a href="#setPoint"><b>setPoint</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;np )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QDropEvent class provides an event which is sent when a drag and drop is completed.<p> When a widget <a href="qwidget.html#setAcceptDrops">accepts drop    events</a>, it will receive this event if it has accepted themost recent <a href="qdragenterevent.html">QDragEnterEvent</a> or <a href="qdragmoveevent.html">QDragMoveEvent</a> sent to it.<p> The widget should use <a href="#data">data</a>() to extract the data in an appropriateformat.<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>QDropEvent::Action</h3><p> This enum describes the action which a source requests that atarget perform with dropped data.<ul><li><tt>QDropEvent::Copy</tt> - The default action. The source simply uses the dataprovided in the operation.<li><tt>QDropEvent::Link</tt> - The source should somehow create a link to thelocation specified by the data.<li><tt>QDropEvent::Move</tt> - The source should somehow move the object from thelocation specified by the data to a new location.<li><tt>QDropEvent::Private</tt> - The target has special knowledge of the MIME type,which the source should respond to in a similar way toa Copy.<li><tt>QDropEvent::UserAction</tt> - The source and target can co-operate usingspecial actions. This feature is not currentlysupported.</ul><p> The Link and Move actions only makes sense if the data is areference, for example, text/uri-list file lists (see <a href="quridrag.html">QUriDrag</a>).<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QDropEvent"></a>QDropEvent::QDropEvent ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, <a href="qevent.html#Type-enum">Type</a>&nbsp;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>QDropEvent::accept ( bool&nbsp;y = TRUE )</h3><p> Call this function to indicate whether the event provided datawhich your widget processed. Set <em>y</em> to TRUE (the default) ifyour 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="qdragobject.html">QDragObject</a> subclasses, such as<a href="qtextdrag.html#decode">QTextDrag::decode</a>(), or your own subclasses.<p> <b>Warning:</b> To accept or reject the drop, don't call this function,call <a href="#acceptAction">acceptAction</a>() instead. This function indicates whether youprocessed the event at all.<p> <p>See also <a href="#acceptAction">acceptAction</a>().<p>Example: <a href="simple_dd-example.html#x2666">iconview/simple_dd/main.cpp</a>.<h3 class=fn>void <a name="acceptAction"></a>QDropEvent::acceptAction ( bool&nbsp;y = TRUE )</h3><p> Call this to indicate that the action described by <a href="#action">action</a>() isaccepted (i.e. if <em>y</em> is TRUE, which is the default), not merelythe default copy action. If you call <a href="#acceptAction">acceptAction</a>(TRUE), there isno need to also call <a href="#accept">accept</a>(TRUE).<p>Examples: <a href="dirview-example.html#x1711">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x812">fileiconview/qfileiconview.cpp</a>.<h3 class=fn><a href="qdropevent.html#Action-enum">Action</a> <a name="action"></a>QDropEvent::action () const</h3><p> Returns the Action which the target is requesting to be performedwith the data. If your application understands the action and canprocess the supplied data, call <a href="#acceptAction">acceptAction</a>(); if yourapplication can process the supplied data but can only perform theCopy action, call <a href="#accept">accept</a>().<p>Examples: <a href="dirview-example.html#x1712">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x813">fileiconview/qfileiconview.cpp</a>.<h3 class=fn><a href="qbytearray.html">QByteArray</a> <a name="data"></a>QDropEvent::data ( const&nbsp;char&nbsp;*&nbsp;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">QDropEvent::encodedData</a>().<h3 class=fn><a href="qbytearray.html">QByteArray</a> <a name="encodedData"></a>QDropEvent::encodedData ( const&nbsp;char&nbsp;*&nbsp;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, whichis potentially very slow, so it's advisable to call this functiononly 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 notavailable.<p> <p>See also <a href="#format">format</a>() and <a href="qmemarray.html#size">QByteArray::size</a>().<p>Reimplemented from <a href="qmimesource.html#encodedData">QMimeSource</a>.<h3 class=fn>const char * <a name="format"></a>QDropEvent::format ( int&nbsp;n = 0 ) const<tt> [virtual]</tt></h3>Returns a string describing one of the available data types forthis drag. Common examples are "text/plain" and "image/gif". If <em>n</em> is less than zero or greater than the number of available datatypes, <a href="#format">format</a>() returns 0.<p> This function is provided mainly for debugging. Most drop targetswill 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#x1151">iconview/main.cpp</a>.<p>Reimplemented from <a href="qmimesource.html#format">QMimeSource</a>.<h3 class=fn>void <a name="ignore"></a>QDropEvent::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#x814">fileiconview/qfileiconview.cpp</a>.<h3 class=fn>bool <a name="isAccepted"></a>QDropEvent::isAccepted () const</h3><p> Returns TRUE if the drop target accepts the event; otherwisereturns FALSE.<h3 class=fn>bool <a name="isActionAccepted"></a>QDropEvent::isActionAccepted () const</h3><p> Returns TRUE if the drop action was accepted by the drop site;otherwise returns FALSE.<h3 class=fn>const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; <a name="pos"></a>QDropEvent::pos () const</h3><p> Returns the position where the drop was made.<p>Example: <a href="dirview-example.html#x1713">dirview/dirview.cpp</a>.<h3 class=fn>bool <a name="provides"></a>QDropEvent::provides ( const&nbsp;char&nbsp;*&nbsp;mimeType ) const<tt> [virtual]</tt></h3>Returns TRUE if this event provides format <em>mimeType</em>; otherwisereturns FALSE.<p> <p>See also <a href="#data">data</a>().<p>Example: <a href="fileiconview-example.html#x815">fileiconview/qfileiconview.cpp</a>.<p>Reimplemented from <a href="qmimesource.html#provides">QMimeSource</a>.<h3 class=fn>void <a name="setAction"></a>QDropEvent::setAction ( <a href="qdropevent.html#Action-enum">Action</a>&nbsp;a )</h3><p> Sets the action to <em>a</em>. This is used internally, you should notneed to call this in your code: the <em>source</em> decides the action,not the target.<h3 class=fn>void <a name="setPoint"></a>QDropEvent::setPoint ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;np )</h3><p> Sets the drop to happen at point <em>np</em>. You do not normally needto use this as it will be set internally before your widgetreceives the drop event.<h3 class=fn><a href="qwidget.html">QWidget</a>&nbsp;* <a name="source"></a>QDropEvent::source () const</h3>If the source of the drag operation is a widget in thisapplication, this function returns that source, otherwise itreturns 0. The source of the operation is the first parameter todrag object subclasses.<p> This is useful if your widget needs special behavior when draggingto itself, etc.<p> See <a href="qdragobject.html#QDragObject">QDragObject::QDragObject</a>() and subclasses.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright &copy; 1995-2002<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 &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -