Sophie

Sophie

distrib > * > 2009.0 > i586 > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2001

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QDrag" doc="/**
&lt;p&gt;The &lt;a href=&quot;QDrag.html#QDrag(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;QDrag&lt;/tt&gt;&lt;/a&gt; class provides support for MIME-based drag and drop data transfer.&lt;/p&gt;
&lt;p&gt;Drag and drop is an intuitive way for users to copy or move data around in an application, and is used in many desktop environments as a mechanism for copying data between applications. Drag and drop support in Qt is centered around the &lt;a href=&quot;QDrag.html#QDrag(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;QDrag&lt;/tt&gt;&lt;/a&gt; class that handles most of the details of a drag and drop operation.&lt;/p&gt;
&lt;p&gt;The data to be transferred by the drag and drop operation is contained in a &lt;a href=&quot;QMimeData.html&quot;&gt;&lt;tt&gt;QMimeData&lt;/tt&gt;&lt;/a&gt; object. This is specified with the &lt;a href=&quot;QDrag.html#setMimeData(com.trolltech.qt.gui.QMimeData)&quot;&gt;&lt;tt&gt;setMimeData&lt;/tt&gt;&lt;/a&gt; function in the following way:&lt;/p&gt;
&lt;pre&gt;            QDrag *drag = new QDrag(this);
            QMimeData *mimeData = new QMimeData;

            mimeData-&amp;gt;setText(commentEdit-&amp;gt;toPlainText());
            drag-&amp;gt;setMimeData(mimeData);&lt;/pre&gt;
&lt;p&gt;Note that &lt;a href=&quot;QDrag.html#setMimeData(com.trolltech.qt.gui.QMimeData)&quot;&gt;&lt;tt&gt;setMimeData&lt;/tt&gt;&lt;/a&gt; assigns ownership of the &lt;a href=&quot;QMimeData.html&quot;&gt;&lt;tt&gt;QMimeData&lt;/tt&gt;&lt;/a&gt; object to the &lt;a href=&quot;QDrag.html#QDrag(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;QDrag&lt;/tt&gt;&lt;/a&gt; object. The &lt;a href=&quot;QDrag.html#QDrag(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;QDrag&lt;/tt&gt;&lt;/a&gt; must be constructed on the heap with a parent &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QObject.html#QObject(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; to ensure that Qt can clean up after the drag and drop operation has been completed.&lt;/p&gt;
&lt;p&gt;A pixmap can be used to represent the data while the drag is in progress, and will move with the cursor to the drop target. This pixmap typically shows an icon that represents the MIME type of the data being transferred, but any pixmap can be set with &lt;a href=&quot;QDrag.html#setPixmap(com.trolltech.qt.gui.QPixmap)&quot;&gt;&lt;tt&gt;setPixmap&lt;/tt&gt;&lt;/a&gt;. Care must be taken to ensure that the pixmap is not too large. The cursor's hot spot can be given a position relative to the top-left corner of the pixmap with the &lt;a href=&quot;QDrag.html#setHotSpot(com.trolltech.qt.core.QPoint)&quot;&gt;&lt;tt&gt;setHotSpot&lt;/tt&gt;&lt;/a&gt; function. The following code positions the pixmap so that the cursor's hot spot points to the center of its bottom edge:&lt;/p&gt;
&lt;pre&gt;        drag-&amp;gt;setHotSpot(QPoint(drag-&amp;gt;pixmap().width()/2,
                                drag-&amp;gt;pixmap().height()));&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; on X11, the pixmap may not be able to keep up with the mouse movements if the hot spot causes the pixmap to be displayed directly under the cursor.&lt;/p&gt;
&lt;p&gt;The source and target widgets can be found with &lt;a href=&quot;QDrag.html#source()&quot;&gt;&lt;tt&gt;source&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QDrag.html#target()&quot;&gt;&lt;tt&gt;target&lt;/tt&gt;&lt;/a&gt;. These functions are often used to determine whether drag and drop operations started and finished at the same widget, so that special behavior can be implemented.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QDrag.html#QDrag(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;QDrag&lt;/tt&gt;&lt;/a&gt; only deals with the drag and drop operation itself. It is up to the developer to decide when a drag operation begins, and how a &lt;a href=&quot;QDrag.html#QDrag(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;QDrag&lt;/tt&gt;&lt;/a&gt; object should be constructed and used. For a given widget, it is often necessary to reimplement mousePressEvent() to determine whether the user has pressed a mouse button, and reimplement mouseMoveEvent() to check whether a &lt;a href=&quot;QDrag.html#QDrag(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;QDrag&lt;/tt&gt;&lt;/a&gt; is required.&lt;/p&gt;

@see &lt;a href=&quot;%2E%2E/dnd.html&quot;&gt;Drag and Drop&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QClipboard.html&quot;&gt;&lt;tt&gt;QClipboard&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QMimeData.html&quot;&gt;&lt;tt&gt;QMimeData&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;QWindowsMime&lt;/tt&gt;
@see &lt;tt&gt;QMacPasteboardMime&lt;/tt&gt;
@see Draggable Icons Example&lt;/tt&gt;
@see Draggable Text Example&lt;/tt&gt;
@see Drop Site Example&lt;/tt&gt;
@see &lt;a href=&quot;%2E%2E/qtjambi-fridgemagnets.html&quot;&gt;Fridge Magnets Example&lt;/tt&gt;&lt;/a&gt; */">
    <signal name="protected final void actionChanged(com.trolltech.qt.core.Qt.DropAction action)" doc="/**
&lt;p&gt;This signal is emitted when the &lt;tt&gt;action&lt;/tt&gt; associated with the drag changes.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signatures:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(com.trolltech.qt.core.Qt.DropAction action)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QDrag.html#targetChanged(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;targetChanged&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void targetChanged(com.trolltech.qt.gui.QWidget newTarget)" doc="/**
&lt;p&gt;This signal is emitted when the target of the drag and drop operation changes, with &lt;tt&gt;newTarget&lt;/tt&gt; the new target.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signatures:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(com.trolltech.qt.gui.QWidget newTarget)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QDrag.html#target()&quot;&gt;&lt;tt&gt;target&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QDrag.html#actionChanged(com.trolltech.qt.core.Qt.DropAction)&quot;&gt;&lt;tt&gt;actionChanged&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <method name="public QDrag(com.trolltech.qt.gui.QWidget dragSource)" doc="/**
&lt;p&gt;Constructs a new drag object for the widget specified by &lt;tt&gt;dragSource&lt;/tt&gt;.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.Qt.DropAction exec(com.trolltech.qt.core.Qt.DropActions supportedActions)" doc="/**
&lt;p&gt;Starts the drag and drop operation and returns a value indicating the requested drop action when it is completed. The drop actions that the user can choose from are specified in &lt;tt&gt;supportedActions&lt;/tt&gt;. The default proposed action will be selected among the allowed actions in the following order : Move, Copy and Link.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Although the drag and drop operation can take some time, this function does not block the event loop. Other events are still delivered to the application while the operation is performed.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.Qt.DropAction exec()" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QDrag.html#exec(com.trolltech.qt.core.Qt.DropActions, com.trolltech.qt.core.Qt.DropAction)&quot;&gt;exec&lt;/tt&gt;&lt;/a&gt;(Qt::MoveAction). */"/>
    <method name="public final com.trolltech.qt.core.Qt.DropAction exec(com.trolltech.qt.core.Qt.DropActions supportedActions, com.trolltech.qt.core.Qt.DropAction defaultAction)" doc="/**
&lt;p&gt;Starts the drag and drop operation and returns a value indicating the requested drop action when it is completed. The drop actions that the user can choose from are specified in &lt;tt&gt;supportedActions&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;tt&gt;defaultAction&lt;/tt&gt; determines which action will be proposed when the user performs a drag without using modifier keys.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Although the drag and drop operation is blocking, the function does not block the event loop. Other events are still delivered to the application while the operation is performed.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.QPoint hotSpot()" doc="/**
&lt;p&gt;Returns the position of the hot spot relative to the top-left corner of the cursor.&lt;/p&gt;

@see &lt;a href=&quot;QDrag.html#setHotSpot(com.trolltech.qt.core.QPoint)&quot;&gt;&lt;tt&gt;setHotSpot&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.gui.QMimeData mimeData()" doc="/**
&lt;p&gt;Returns the MIME data that is encapsulated by the drag object.&lt;/p&gt;

@see &lt;a href=&quot;QDrag.html#setMimeData(com.trolltech.qt.gui.QMimeData)&quot;&gt;&lt;tt&gt;setMimeData&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.gui.QPixmap pixmap()" doc="/**
&lt;p&gt;Returns the pixmap used to represent the data in a drag and drop operation.&lt;/p&gt;

@see &lt;a href=&quot;QDrag.html#setPixmap(com.trolltech.qt.gui.QPixmap)&quot;&gt;&lt;tt&gt;setPixmap&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setDragCursor(com.trolltech.qt.gui.QPixmap cursor, com.trolltech.qt.core.Qt.DropAction action)" doc="/**
&lt;p&gt;Sets the drag &lt;tt&gt;cursor&lt;/tt&gt; for the &lt;tt&gt;action&lt;/tt&gt;. This allows you to override the default native cursors. To revert to using the native cursor for &lt;tt&gt;action&lt;/tt&gt; pass in a null &lt;a href=&quot;QPixmap.html&quot;&gt;&lt;tt&gt;QPixmap&lt;/tt&gt;&lt;/a&gt; as &lt;tt&gt;cursor&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;tt&gt;action&lt;/tt&gt; can only be CopyAction, MoveAction or LinkAction. All other values of DropAction are ignored.&lt;/p&gt;
 */"/>
    <method name="public final void setHotSpot(com.trolltech.qt.core.QPoint hotspot)" doc="/**
&lt;p&gt;Sets the position of the hot spot relative to the top-left corner of the pixmap used to the point specified by &lt;tt&gt;hotspot&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; on X11, the pixmap may not be able to keep up with the mouse movements if the hot spot causes the pixmap to be displayed directly under the cursor.&lt;/p&gt;

@see &lt;a href=&quot;QDrag.html#hotSpot()&quot;&gt;&lt;tt&gt;hotSpot&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setMimeData(com.trolltech.qt.gui.QMimeData data)" doc="/**
&lt;p&gt;Sets the data to be sent to the given MIME &lt;tt&gt;data&lt;/tt&gt;. Ownership of the data is transferred to the &lt;a href=&quot;QDrag.html#QDrag(com.trolltech.qt.gui.QWidget)&quot;&gt;&lt;tt&gt;QDrag&lt;/tt&gt;&lt;/a&gt; object.&lt;/p&gt;

@see &lt;a href=&quot;QDrag.html#mimeData()&quot;&gt;&lt;tt&gt;mimeData&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setPixmap(com.trolltech.qt.gui.QPixmap arg__1)" doc="/**
&lt;p&gt;Sets &lt;tt&gt;arg__1&lt;/tt&gt; as the pixmap used to represent the data in a drag and drop operation. You can only set a pixmap before the drag is started.&lt;/p&gt;

@see &lt;a href=&quot;QDrag.html#pixmap()&quot;&gt;&lt;tt&gt;pixmap&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.gui.QWidget source()" doc="/**
&lt;p&gt;Returns the source of the drag object. This is the widget where the drag and drop operation originated.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.gui.QWidget target()" doc="/**
&lt;p&gt;Returns the target of the drag and drop operation. This is the widget where the drag object was dropped.&lt;/p&gt;
 */"/>
</class>