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

@ -188,11 +188,12 @@ void CardInfoWidget::updatePixmap()
if (pixmapWidth == 0)
return;
QPixmap *resizedPixmap = info->getPixmap(QSize(pixmapWidth, pixmapWidth * aspectRatio));
if (resizedPixmap)
cardPicture->setPixmap(*resizedPixmap);
else
cardPicture->setPixmap(*(getCard()->getPixmap(QSize(pixmapWidth, pixmapWidth * aspectRatio))));
QPixmap resizedPixmap;
info->getPixmap(QSize(pixmapWidth, pixmapWidth * aspectRatio), resizedPixmap);
if (resizedPixmap.isNull())
getCard()->getPixmap(QSize(pixmapWidth, pixmapWidth * aspectRatio), resizedPixmap);
cardPicture->setPixmap(resizedPixmap);
}
void CardInfoWidget::retranslateUi()