Use QPixmapCache for card images

Drop CardInfo’s own pixmap caches; use QPixmapCache instead.
Use QPixmap references instead of pointers.
Being stored in QPixmapCache, all card images are now subjected to
QPixmapCache’s size limit
This commit is contained in:
Fabio Bas 2014-12-24 16:18:55 +01:00
parent b96104bed4
commit f88621fd97
5 changed files with 71 additions and 69 deletions

View file

@ -41,13 +41,14 @@ void CardInfoPicture::updatePixmap()
return;
}
QPixmap *resizedPixmap = info->getPixmap(QSize(pixmapWidth, pixmapWidth * aspectRatio));
if (resizedPixmap) {
setNoPicture(false);
this->setPixmap(*resizedPixmap);
}
else {
QPixmap resizedPixmap;
info->getPixmap(QSize(pixmapWidth, pixmapWidth * aspectRatio), resizedPixmap);
if (resizedPixmap.isNull()) {
setNoPicture(true);
this->setPixmap(*(db->getCard()->getPixmap(QSize(pixmapWidth, pixmapWidth * aspectRatio))));
db->getCard()->getPixmap(QSize(pixmapWidth, pixmapWidth * aspectRatio), resizedPixmap);
} else {
setNoPicture(false);
}
this->setPixmap(resizedPixmap);
}