返回介绍

QImageDrag Class

发布于 2019-10-04 15:00:46 字数 2957 浏览 1018 评论 0 收藏 0

The QImageDrag class provides a drag and drop object for transferring images. More...

#include <qdragobject.h>

Inherits QDragObject.

List of all member functions.

Public Members

  • QImageDrag ( QImageimage, QWidget*dragSource = 0, constchar*name = 0 )
  • QImageDrag ( QWidget*dragSource = 0, constchar*name = 0 )
  • ~QImageDrag ()
  • virtual void setImage ( QImageimage )

Static Public Members

  • bool canDecode ( constQMimeSource*e )
  • bool decode ( constQMimeSource*e, QImage&img )
  • bool decode ( constQMimeSource*e, QPixmap&pm )

Detailed Description

The QImageDrag class provides a drag and drop object for transferring images.

Images are offered to the receiving application in multiple formats, determined by Qt's output formats.

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

See also Drag And Drop Classes.


Member Function Documentation

QImageDrag::QImageDrag ( QImageimage, QWidget*dragSource = 0, constchar*name = 0 )

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

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

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

QImageDrag::~QImageDrag ()

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

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

Returns TRUE if the information in mime source e can be decoded into an image; otherwise returns FALSE.

See also decode().

Example: desktop/desktop.cpp.

bool QImageDrag::decode ( constQMimeSource*e, QImage&img ) [static]

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

See also canDecode().

Example: desktop/desktop.cpp.

bool QImageDrag::decode ( constQMimeSource*e, QPixmap&pm ) [static]

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

Attempts to decode the dropped information in mime source e into pixmap pm. Returns TRUE if successful; otherwise returns FALSE.

This is a convenience function that converts to a QPixmap via a QImage.

See also canDecode().

void QImageDrag::setImage ( QImageimage ) [virtual]

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

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

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

发布评论

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