qml截图
原创
©著作权归作者所有:来自51CTO博客作者303103757q的原创作品,请联系作者获取转载授权,否则将追究法律责任
CQLPushButton {
id: button5
x: 4
y: 201
width: 190
height: 90
m_text: qsTr("导出jpg")
onClickedSignal: {
fds.open();
}
}
FileDialog {
id:fds
title: "选择保存文件路径"
folder: shortcuts.desktop
selectExisting: true
selectFolder: true
selectMultiple: false
onAccepted: {
rectangle.grabToImage(function(result) {
var path = fds.fileUrl + "/aa.jpg";
var path1 = path.substring(8,path.length);
console.log(path1);
result.saveToFile( path1);
});
}
}