1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

FTW: Use KeepAspectRatioByExpanding

This commit is contained in:
krepa098 2015-02-07 14:33:45 +01:00
parent 6b605fbdc3
commit d008b53c6f

View File

@ -380,8 +380,8 @@ void FileTransferWidget::showPreview(const QString &filename)
if(previewExtensions.contains(QFileInfo(filename).suffix())) if(previewExtensions.contains(QFileInfo(filename).suffix()))
{ {
//QPixmap pmap = QPixmap(filename).scaled(QSize(ui->previewLabel->maximumWidth(), maximumHeight()), Qt::KeepAspectRatio, Qt::SmoothTransformation); const int size = qMax(ui->previewLabel->width(), ui->previewLabel->height());
QPixmap pmap = QPixmap(filename).scaledToWidth(ui->previewLabel->maximumWidth(), Qt::SmoothTransformation); QPixmap pmap = QPixmap(filename).scaled(QSize(size, size), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
ui->previewLabel->setPixmap(pmap); ui->previewLabel->setPixmap(pmap);
ui->previewLabel->show(); ui->previewLabel->show();
} }