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

Cleanly open/close FT image preview buffer

This commit is contained in:
tux3 2015-05-10 02:30:47 +02:00
parent a232e5afd6
commit b8d57cf43a
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -502,7 +502,9 @@ void FileTransferWidget::showPreview(const QString &filename)
QImage image = QImage(filename).scaled(0.5*desktopSize.width(), 0.5*desktopSize.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
QByteArray imageData;
QBuffer buffer(&imageData);
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, "PNG");
buffer.close();
ui->previewLabel->setToolTip("<img src=data:image/png;base64," + imageData.toBase64() + "/>");
}
}