QPixmap和SVG [英] QPixmap and SVG

查看:438
本文介绍了QPixmap和SVG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何建议使用QPixmap处理svg?

How would you suggest to handle svg with QPixmap?

构造QPixmap(":/myfile.svg");然后调用scaled()无效. QPixmap像素化.

The construct QPixmap(":/myfile.svg"); then call of scaled() does not work. The QPixmap gets pixelised.

谢谢.

推荐答案

您应使用 SVGRenderer 将其渲染到QImage上.从那里可以用QPixmap::convertFromImage转换为QPixmap.

You should use SVGRenderer to render it onto a QImage. From there you can convert to a QPixmap with QPixmap::convertFromImage.

这篇关于QPixmap和SVG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆