mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
avoid temporary in QItemDelegate::selected()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
443516dafa
commit
a779a4742f
1 changed files with 1 additions and 2 deletions
|
@ -1005,12 +1005,11 @@ QPixmap *QItemDelegate::selected(const QPixmap &pixmap, const QPalette &palette,
|
||||||
painter.fillRect(0, 0, img.width(), img.height(), color);
|
painter.fillRect(0, 0, img.width(), img.height(), color);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
QPixmap selected = QPixmap::fromImage(img);
|
|
||||||
int n = (img.byteCount() >> 10) + 1;
|
int n = (img.byteCount() >> 10) + 1;
|
||||||
if (QPixmapCache::cacheLimit() < n)
|
if (QPixmapCache::cacheLimit() < n)
|
||||||
QPixmapCache::setCacheLimit(n);
|
QPixmapCache::setCacheLimit(n);
|
||||||
|
|
||||||
QPixmapCache::insert(key, selected);
|
QPixmapCache::insert(key, QPixmap::fromImage(img));
|
||||||
pm = QPixmapCache::find(key);
|
pm = QPixmapCache::find(key);
|
||||||
}
|
}
|
||||||
return pm;
|
return pm;
|
||||||
|
|
Loading…
Add table
Reference in a new issue