我有以下小部件:
pixmap = QtGui.QPixmap(r'pics\cdaudio.png').scaled(100, 100)
Run Code Online (Sandbox Code Playgroud)
图像按比例缩小,从256x256.它看起来很不稳定:

如何从Qt内平滑地缩放?
使用transformMode参数:
pixmap = QtGui.QPixmap(r'pics\cdaudio.png').scaled(100, 100, transformMode=QtCore.Qt.SmoothTransformation)
Run Code Online (Sandbox Code Playgroud)
根据@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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4890 次 |
| 最近记录: |