qtextdrag.3qt man page

QTextDrag — Drag and drop object for transferring plain and Unicode text

Synopsis

#include <qdragobject.h>

Inherits QDragObject.

Public Members

QTextDrag ( const QString & text, QWidget * dragSource = 0, const char * name = 0 )

QTextDrag ( QWidget * dragSource = 0, const char * name = 0 )

~QTextDrag ()

virtual void setText ( const QString & text )

virtual void setSubtype ( const QCString & st )

Static Public Members

bool canDecode ( const QMimeSource * e )

bool decode ( const QMimeSource * e, QString & str )

bool decode ( const QMimeSource * e, QString & str, QCString & subtype )

Description

The QTextDrag class is a drag and drop object for transferring plain and Unicode text.

Plain text is passed in a QString which may contain multiple lines (i.e. may contain newline characters). The drag target will receive the newlines according to the runtime environment, e.g. LF on Unix, and CRLF on Windows.

Qt provides no built-in mechanism for delivering only a single-line.

For more information about drag and drop, see the QDragObject class and the drag and drop documentation.

See also Drag And Drop Classes.

QTextDrag::QTextDrag ( const QString & text, QWidget * dragSource = 0, const char * name = 0 )

Constructs a text drag object and sets its data to text. dragSource must be the drag source; name is the object name.

QTextDrag::QTextDrag ( QWidget * dragSource = 0, const char * name = 0 )

Constructs a default text drag object. dragSource must be the drag source; name is the object name.

QTextDrag::~QTextDrag ()

Destroys the text drag object and frees up all allocated resources.

bool QTextDrag::canDecode ( const QMimeSource * e ) [static]

Returns TRUE if the information in e can be decoded into a QString; otherwise returns FALSE.

See also decode().

Example: iconview/simple_dd/main.cpp.

bool QTextDrag::decode ( const QMimeSource * e, QString & str ) [static]

Attempts to decode the dropped information in e into str. Returns TRUE if successful; otherwise returns FALSE.

See also canDecode().

Example: iconview/simple_dd/main.cpp.

bool QTextDrag::decode ( const QMimeSource * e, QString & str, QCString & subtype ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Attempts to decode the dropped information in e into str. Returns TRUE if successful; otherwise returns FALSE. If subtype is null, any text subtype is accepted; otherwise only the specified subtype is accepted.

See also canDecode().

void QTextDrag::setSubtype ( const QCString & st ) [virtual]

Sets the MIME subtype of the text being dragged to st. The default subtype is "plain", so the default MIME type of the text is "text/plain". You might use this to declare that the text is" text/html" by calling setSubtype("html").

void QTextDrag::setText ( const QString & text ) [virtual]

Sets the text to be dragged to text. You will need to call this if you did not pass the text during construction.

See Also

http://doc.trolltech.com/qtextdrag.html http://www.trolltech.com/faq/tech.html

Author

Generated automatically from the source code.

Bugs

If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qtextdrag.3qt) and the Qt version (3.3.8).

Referenced By

QTextDrag.3qt(3) is an alias of qtextdrag.3qt(3).

2 February 2007 Trolltech AS