QQuickItemGrabResult Class

The QQuickItemGrabResult contains the result from QQuickItem::grabToImage (). 更多...

头: #include <QQuickItemGrabResult>
CMake: find_package(Qt6 COMPONENTS Quick REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
实例化: ItemGrabResult
继承: QObject

特性

公共函数

QImage image () const
bool saveToFile (const QString & fileName ) const
bool saveToFile (const QUrl & filePath ) const
QUrl url () const

信号

void ready ()

详细描述

另请参阅 QQuickItem::grabToImage ().

特性文档编制

[read-only] image : const QImage

This property holds the pixel results from a grab.

If the grab is not yet complete or if it failed, a null image is returned ( image.isNull() 将返回 true ).

访问函数:

QImage image () const

[read-only] url : const QUrl

This property holds a URL which can be used in conjunction with URL based image consumers, such as the QtQuick::Image type.

The URL is valid until the QQuickItemGrabResult object is deleted.

The URL does not represent a valid file or location to read it from, it is primarily a key to access images through Qt Quick's image-based types.

访问函数:

QUrl url () const

成员函数文档编制

[signal] void QQuickItemGrabResult:: ready ()

This signal is emitted when the grab has completed.

[invokable] bool QQuickItemGrabResult:: saveToFile (const QString & fileName ) const

Saves the grab result as an image to fileName 。返回 true 若成功;否则返回 false .

注意: In Qt versions prior to 5.9, this function is marked as non- const .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable, since 6.2] bool QQuickItemGrabResult:: saveToFile (const QUrl & filePath ) const

Saves the grab result as an image to filePath , which must refer to a local file name 采用 supported image format extension. Returns true 若成功;否则返回 false .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

该函数在 Qt 6.2 引入。