forked from qt-creator/qt-creator
QmlDesigner: Fix asset images becoming invalid after delete + recreate
The problem was that, for "invalid assets" (i.e. pixmaps of assets that could not be read / did not exist on disk), the "default" thumbnail was saved in the cache -- and thus, when the asset re-appeared on disk, the "default" (invalid) thumbnail was shown. Task-number: QDS-8591 Change-Id: Iec2f3e704c1deef2e7a7c75532518639fdc677e5 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -25,12 +25,16 @@ QPixmap AssetsLibraryIconProvider::requestPixmap(const QString &id, QSize *size,
|
||||
pixmap = m_thumbnails[id];
|
||||
} else {
|
||||
pixmap = fetchPixmap(id, requestedSize);
|
||||
if (pixmap.isNull())
|
||||
bool haveValidImage = true;
|
||||
if (pixmap.isNull()) {
|
||||
pixmap = Utils::StyleHelper::dpiSpecificImageFile(":/AssetsLibrary/images/assets_default.png");
|
||||
haveValidImage = false;
|
||||
}
|
||||
|
||||
if (requestedSize.isValid())
|
||||
pixmap = pixmap.scaled(requestedSize, Qt::KeepAspectRatio);
|
||||
|
||||
if (haveValidImage)
|
||||
m_thumbnails[id] = pixmap;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user