本页内容

ItemGrabResult QML Type

包含对 `Item::grabToImage()` 调用的结果。更多内容...

Import Statement: import QtQuick
In C++: QQuickItemGrabResult
Inherits:

QtObject

属性

方法

详细说明

ItemGrabResult 是一个小型容器,用于封装Item::grabToImage() 返回的结果。

另请参阅 Item::grabToImage()。

属性文档

image : variant [read-only]

该属性以QImage 的形式存储抓取操作得到的像素结果。

url : url [read-only]

该属性存储一个 URL,可与基于 URL 的图像消费类(如 QtQuick::Image 类型)配合使用。

只要 QML 或 JavaScript 中存在对ItemGrabResult 的引用,或者该 URL 所引用的图像正在被使用,该 URL 即为有效。

该 URL 并不代表一个有效的文件或读取该文件的路径,它主要是用于通过Qt Quick 的基于图像的类型访问图像的键。

方法文档

bool saveToFile(fileName)

将抓取结果保存为图片,并上传至fileName 。若操作成功,则返回true ;否则返回false 。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.