7

我有以下小部件:

pixmap = QtGui.QPixmap(r'pics\cdaudio.png').scaled(100, 100)

图像从 256x256 缩小。它看起来很波涛汹涌:

在此处输入图像描述

如何在 Qt 中平滑地扩展它?

4

3 回答 3

17

使用transformMode参数:

pixmap = QtGui.QPixmap(r'pics\cdaudio.png').scaled(100, 100, transformMode=QtCore.Qt.SmoothTransformation)
于 2012-12-15T09:57:17.780 回答
5

根据@iTayb,这是我想出的:

// Scale the source to the requested size with 
//  the KeepAspectRatio as aspectMode & SmoothTransformation as mode
*source = source->scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
target->setPixmap(*source);
于 2014-06-06T05:20:46.163 回答
0

如果可能的话,为什么不使用 SVG 格式(以及 Qt SVG 模块)?

于 2012-12-16T02:30:46.403 回答