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:
parent
a232e5afd6
commit
b8d57cf43a
|
@ -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);
|
QImage image = QImage(filename).scaled(0.5*desktopSize.width(), 0.5*desktopSize.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
QByteArray imageData;
|
QByteArray imageData;
|
||||||
QBuffer buffer(&imageData);
|
QBuffer buffer(&imageData);
|
||||||
|
buffer.open(QIODevice::WriteOnly);
|
||||||
image.save(&buffer, "PNG");
|
image.save(&buffer, "PNG");
|
||||||
|
buffer.close();
|
||||||
ui->previewLabel->setToolTip("<img src=data:image/png;base64," + imageData.toBase64() + "/>");
|
ui->previewLabel->setToolTip("<img src=data:image/png;base64," + imageData.toBase64() + "/>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user