QPixmap QPixmap::scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation)
Qt::AspectRatioMode aspectRatioMode:
- Qt::IgnoreAspectRatio 忽略图片比例,直接缩放到size(图中-IgnoreAspectRatio)。 If aspectRatioMode is Qt::IgnoreAspectRatio, the pixmap is scaled to size.
- Qt::KeepAspectRatio 保持图片比例,缩放到size内最大矩形(图中-KeepAspectRatio)。 If aspectRatioMode is Qt::KeepAspectRatio, the pixmap is scaled to a rectangle as large as possible inside size, preserving the aspect ratio.
- Qt::KeepAspectRatioByExpanding 保持图片比例,缩放到超出size的矩形(图中-KeepAspectRatioByExpanding,填满矩形,右方或下方超出)。 If aspectRatioMode is Qt::KeepAspectRatioByExpanding, the pixmap is scaled to a rectangle as small as possible outside size, preserving the aspect ratio.