Button {
id: button
onClicked: {
button.grabToImage(function(img) {
img.saveToFile("test.png");
});
}
}
本文介绍了一种使用 Qt 中 Button 控件的功能,通过 button 的 grabbedToImage 方法将按钮界面抓取为图像,并保存为文件的方法。示例代码展示了如何在按钮被点击时触发这一操作,并将图像保存为 test.png。
Button {
id: button
onClicked: {
button.grabToImage(function(img) {
img.saveToFile("test.png");
});
}
}
439
1157
1787

被折叠的 条评论
为什么被折叠?