返回介绍

QUriDrag Class

发布于 2019-10-04 15:03:44 字数 6008 浏览 964 评论 0 收藏 0

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

#include <qdragobject.h>

Inherits QStoredDrag.

List of all member functions.

Public Members

  • QUriDrag ( QStrListuris, QWidget*dragSource = 0, constchar*name = 0 )
  • QUriDrag ( QWidget*dragSource = 0, constchar*name = 0 )
  • ~QUriDrag ()
  • void setFilenames ( constQStringList&fnames ) (obsolete)
  • void setFileNames ( constQStringList&fnames )
  • void setUnicodeUris ( constQStringList&uuris )
  • virtual void setUris ( QStrListuris )

Static Public Members

  • QString uriToLocalFile ( constchar*uri )
  • QCString localFileToUri ( constQString&filename )
  • QString uriToUnicodeUri ( constchar*uri )
  • QCString unicodeUriToUri ( constQString&uuri )
  • bool canDecode ( constQMimeSource*e )
  • bool decode ( constQMimeSource*e, QStrList&l )
  • bool decodeToUnicodeUris ( constQMimeSource*e, QStringList&l )
  • bool decodeLocalFiles ( constQMimeSource*e, QStringList&l )

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-readble form with setUnicodeUris().

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

See also Drag And Drop Classes.


Member Function Documentation

QUriDrag::QUriDrag ( QStrListuris, QWidget*dragSource = 0, constchar*name = 0 )

Constructs an object to drag the list of URIs in uris. The dragSource and name arguments are passed on to QStoredDrag. Note that URIs are always in escaped UTF8 encoding, as defined by the W3C.

QUriDrag::QUriDrag ( QWidget*dragSource = 0, constchar*name = 0 )

Constructs an object to drag. You must call setUris() before you start the drag(). Passes dragSource and name to the QStoredDrag constructor.

QUriDrag::~QUriDrag ()

Destroys the object.

bool QUriDrag::canDecode ( constQMimeSource*e ) [static]

Returns TRUE if decode() would be able to decode e; otherwise returns FALSE.

bool QUriDrag::decode ( constQMimeSource*e, QStrList&l ) [static]

Decodes URIs from e, placing the result in l (which is first cleared).

Returns TRUE if e contained a valid list of URIs; otherwise returns FALSE.

Examples: dirview/dirview.cpp and fileiconview/qfileiconview.cpp.

bool QUriDrag::decodeLocalFiles ( constQMimeSource*e, QStringList&l ) [static]

Decodes URIs from the mime source event e, converts them to local files if they refer to local files, and places them in l (which is first cleared).

Returns TRUE if contained a valid list of URIs; otherwise returns FALSE. The list will be empty if no URIs were local files.

bool QUriDrag::decodeToUnicodeUris ( constQMimeSource*e, QStringList&l ) [static]

Decodes URIs from the mime source event e, converts them to Unicode URIs (only useful for displaying to humans), placing them in l (which is first cleared).

Returns TRUE if contained a valid list of URIs; otherwise returns FALSE.

QCString QUriDrag::localFileToUri ( constQString&filename ) [static]

Returns the URI equivalent to the absolute local file filename.

See also uriToLocalFile().

void QUriDrag::setFileNames ( constQStringList&fnames )

Sets the URIs to be the local-file URIs equivalent to fnames.

See also localFileToUri() and setUris().

void QUriDrag::setFilenames ( constQStringList&fnames )

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

Use setFileNames() instead (notice the N).

void QUriDrag::setUnicodeUris ( constQStringList&uuris )

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

See also localFileToUri() and setUris().

Example: dirview/dirview.cpp.

void QUriDrag::setUris ( QStrListuris ) [virtual]

Changes the list of uris to be dragged.

QCString QUriDrag::unicodeUriToUri ( constQString&uuri ) [static]

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

See also uriToLocalFile().

QString QUriDrag::uriToLocalFile ( constchar*uri ) [static]

Returns the name of a local file equivalent to uri or a null string if uri is not a local file.

See also localFileToUri().

QString QUriDrag::uriToUnicodeUri ( constchar*uri ) [static]

Returns the Unicode URI (only useful for displaying to humans) equivalent of uri.

See also localFileToUri().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文