QmlDesigner: Fix asset library shader icon

Also fix showing correct icon when the asset's extension has uppercase
characters.

Fixes: QDS-4583
Change-Id: I697f13c10d475d07dbcd44299a427190e1a8681f
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2021-06-17 15:23:35 +03:00
parent 03985dd55e
commit e0c89a91e0

View File

@@ -41,13 +41,15 @@ ItemLibraryAssetsIconProvider::ItemLibraryAssetsIconProvider(SynchronousImageCac
QPixmap ItemLibraryAssetsIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) QPixmap ItemLibraryAssetsIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{ {
QPixmap pixmap; QPixmap pixmap;
const QString suffix = "*." + id.split('.').last(); const QString suffix = "*." + id.split('.').last().toLower();
if (ItemLibraryAssetsModel::supportedFontSuffixes().contains(suffix)) if (ItemLibraryAssetsModel::supportedFontSuffixes().contains(suffix))
pixmap = generateFontIcons(id); pixmap = generateFontIcons(id);
else if (ItemLibraryAssetsModel::supportedImageSuffixes().contains(suffix)) else if (ItemLibraryAssetsModel::supportedImageSuffixes().contains(suffix))
pixmap = Utils::StyleHelper::dpiSpecificImageFile(id); pixmap = Utils::StyleHelper::dpiSpecificImageFile(id);
else if (ItemLibraryAssetsModel::supportedTexture3DSuffixes().contains(suffix)) else if (ItemLibraryAssetsModel::supportedTexture3DSuffixes().contains(suffix))
pixmap = HdrImage{id}.toPixmap(); pixmap = HdrImage{id}.toPixmap();
else if (ItemLibraryAssetsModel::supportedShaderSuffixes().contains(suffix))
pixmap = QPixmap(Utils::StyleHelper::dpiSpecificImageFile(":/ItemLibrary/images/asset_shader_48.png"));
else if (ItemLibraryAssetsModel::supportedAudioSuffixes().contains(suffix)) else if (ItemLibraryAssetsModel::supportedAudioSuffixes().contains(suffix))
pixmap = QPixmap(Utils::StyleHelper::dpiSpecificImageFile(":/ItemLibrary/images/asset_sound_48.png")); pixmap = QPixmap(Utils::StyleHelper::dpiSpecificImageFile(":/ItemLibrary/images/asset_sound_48.png"));