Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

QUriDrag Class Reference

The QUriDrag class provides a drag object for a list of URI references. More...

#include <QUriDrag>

Inherits QStoredDrag.

List of all members.

Writable Properties

Public Functions

Public Slots

Signals

Static Public Members

Protected Functions


Detailed Description

The QUriDrag class provides a drag object for a list of URI references.

URIs are a useful way to refer to files that may be distributed across multiple machines. A URI will often refer to a file on a machine local to both the drag source and the drop target, so the URI can be equivalent to passing a file name but is more extensible.

Use URIs in Unicode form so that the user can comfortably edit and view them. For use in HTTP or other protocols, use the correctly escaped ASCII form.

You can convert a list of file names to file URIs using setFileNames(), or into human-readable form with setUnicodeUris().

Static functions are provided to convert between filenames and URIs; e.g. uriToLocalFile() and localFileToUri(). Static functions are also provided to convert URIs to and from human-readable form; e.g. uriToUnicodeUri() and unicodeUriToUri(). You can also decode URIs from a MIME source into a list with decodeLocalFiles() and decodeToUnicodeUris().


Member Function Documentation

QUriDrag::QUriDrag ( const QList<QByteArray> & uris, QWidget * dragSource = 0 )

Constructs a dragSource object to drag the given list of uris. The dragSource is passed to the QStoredDrag constructor.

Note that URIs are always in escaped UTF-8 encoding.

QUriDrag::QUriDrag ( QWidget * dragSource = 0 )

Constructs an object to drag for the given dragSource. You must call setUris() before you start the drag(). The dragSource is passed to the QStoredDrag constructor.

QUriDrag::~QUriDrag ()

Destroys the URI drag object.

bool QUriDrag::canDecode ( const QMimeSource * source )   [static]

Returns true if decode() can decode the MIME source; otherwise returns false.

bool QUriDrag::decode ( const QMimeSource * source, QList<QByteArray> & list )   [static]

Decodes URIs from the MIME source, placing the result in the list. The list is cleared before any items are inserted.

Returns true if the MIME source contained a valid list of URIs; otherwise returns false.

bool QUriDrag::decodeLocalFiles ( const QMimeSource * source, QStringList & list )   [static]

Decodes URIs from the MIME source, converting them to local filenames where possible, and places them in the list (which is first cleared).

Returns true if the MIME source contained a valid list of URIs; otherwise returns false. The list will be empty if no URIs referred to local files.

bool QUriDrag::decodeToUnicodeUris ( const QMimeSource * source, QStringList & list )   [static]

Decodes URIs from the MIME source, converting them to Unicode URIs (only useful for displaying to humans), and places them in the list (which is first cleared).

Returns true if the MIME source contained a valid list of URIs; otherwise returns false.

QByteArray QUriDrag::localFileToUri ( const QString & filename )   [static]

Returns the URI equivalent to the absolute local filename.

See also uriToLocalFile().

void QUriDrag::setFileNames ( const QStringList & filenames )

Sets the URIs to be local file URIs equivalent to the filenames.

See also localFileToUri() and setUris().

void QUriDrag::setFilenames ( const QStringList & list )

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Sets the filename's in the drag object to those in the given list.

Use setFileNames() instead.

void QUriDrag::setUnicodeUris ( const QStringList & list )

Sets the URIs in the list to be Unicode URIs (only useful for displaying to humans).

See also localFileToUri() and setUris().

void QUriDrag::setUris ( const QList<QByteArray> & list )   [virtual]

Changes the list of URIs to be dragged.

Note that URIs are always in escaped UTF8 encoding.

QByteArray QUriDrag::unicodeUriToUri ( const QString & string )   [static]

Returns the URI equivalent of the Unicode URI given in the string (only useful for displaying to humans).

See also uriToLocalFile().

QString QUriDrag::uriToLocalFile ( const char * string )   [static]

Returns the name of a local file equivalent to the URI given in the string, or a null string if it does not refer to a local file.

Note that URIs are always in escaped UTF8 encoding.

See also localFileToUri().

QString QUriDrag::uriToUnicodeUri ( const char * string )   [static]

Returns the Unicode URI (only useful for displaying to humans) equivalent of the URI given in the string.

Note that URIs are always in escaped UTF8 encoding.

See also localFileToUri().


Copyright © 2004 Trolltech. Trademarks
Qt 4.0.0-tp1