MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / setIcon

Method setIcon

launcher/minecraft/mod/Mod.cpp:294–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294QPixmap Mod::setIcon(QImage new_image) const
295{
296 QMutexLocker locker(&m_data_lock);
297
298 Q_ASSERT(!new_image.isNull());
299
300 if (m_packImageCacheKey.key.isValid())
301 PixmapCache::remove(m_packImageCacheKey.key);
302
303 // scale the image to avoid flooding the pixmapcache
304 auto pixmap =
305 QPixmap::fromImage(new_image.scaled({ 64, 64 }, Qt::AspectRatioMode::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
306
307 m_packImageCacheKey.key = PixmapCache::insert(pixmap);
308 m_packImageCacheKey.wasEverUsed = true;
309 m_packImageCacheKey.wasReadAttempt = true;
310 return pixmap;
311}
312
313QPixmap Mod::icon(QSize size, Qt::AspectRatioMode mode) const
314{

Callers 5

processFlameMethod · 0.45
processModrinthMethod · 0.45
askPlayDemoMethod · 0.45
readyForLaunchMethod · 0.45
processIconPNGFunction · 0.45

Calls 1

isValidMethod · 0.45

Tested by

no test coverage detected