简体   繁体   English

将Qt QML文件转换为位图图像

[英]convert Qt qml file to bit map image

I want to take a qml I created in the QTCreator and transform it to a bmp image. 我想使用在QTCreator中创建的qml并将其转换为bmp图像。 what I want in the bmp image is just the items I created. 我想要的bmp图像就是我创建的项目。 I read about grabWindow but this is not realy what I want because it takes a snapshot of the screen and not creating bmp image with only the items in the qml. 我了解了关于grabWindow的信息,但这并不是我想要的,因为它需要屏幕快照,而不是仅用qml中的项目创建bmp图像。

Thanks 谢谢

From QML: 从QML:

youritem.grabToImage(function(result) {
   result.saveToFile("something.bmp");
});

Although a bmp image is a bad idea, those things are huge. 尽管bmp映像不是一个好主意,但是这些事情是巨大的。 png is the best candidate for QML stuff, which is usually more "vector-y". png是QML素材的最佳选择,通常是“ vector-y”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM