Display conversation images

This commit is contained in:
2018-12-19 08:49:54 +01:00
parent 9100c14dfd
commit 6062eaf2c8
5 changed files with 51 additions and 13 deletions

View File

@ -135,7 +135,17 @@ void ImageLoadHelper::ApplyImage(QLabel *label, const QString &url)
void ImageLoadHelper::ApplyImage(QLabel *label, const QPixmap &pixmap)
{
label->setPixmap(pixmap);
//Check if we need to scale image
if(
(label->maximumWidth() > 100000 || label->maximumHeight() > 100000) || //No maximum size
(label->maximumWidth() > pixmap.width() && label->maximumHeight() > pixmap.height()) //Image smaller than maximum size
){
label->setPixmap(pixmap);
return;
}
//Else we scale image
label->setPixmap(pixmap.scaled(label->maximumSize(), Qt::KeepAspectRatio));
}
bool ImageLoadHelper::IsDownloaded(const QString &url)