2011-10-01 136 views
3

在基于PyQt的GUI程序中,我在调整大小后将几个PNG文件绘制为QPixmap。所以这里基本上会发生什么:抗锯齿PNG在Qt中调整大小?

bitmap = QPixmap("foo.png") 
bitmap.scaleToHeight(38) # original is larger than this 
scene.addItem(QGraphicsPixmapItem(bitmap)) # Add to graphics scene 

问题是:之后,位图相当丑陋。有没有办法以抗锯齿的方式做到这一点?

回答

6

查看documentation

bitmap = bitmap.scaledToHeight(38, Qt.SmoothTransformation) 
+0

谢谢。它现在看起来很漂亮 - 可以更仔细地阅读文档。 – lang2