QmlDesigner: Add light/camera icons when exporting a bundle

Fixes: QDS-13310
Change-Id: I6d15f91fa664eb7b861ed2acfba916e35900ae90
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Shrief Gabr <shrief.gabr@qt.io>
This commit is contained in:
Mahmoud Badri
2024-08-05 15:18:21 +03:00
parent 0a54933c8d
commit 5d8e795ebf

View File

@@ -1016,11 +1016,19 @@ void ContentLibraryView::exportLibItem(const ModelNode &node, const QPixmap &ico
m_zipWriter->addFile(assetPath.relativePath, assetPath.absFilPath().fileContents().value_or(""));
// add icon
QPixmap iconPixmapToSave;
if (node.metaInfo().isQtQuick3DCamera())
iconPixmapToSave = m_widget->iconProvider()->requestPixmap("camera.png", nullptr, {});
else if (node.metaInfo().isQtQuick3DLight())
iconPixmapToSave = m_widget->iconProvider()->requestPixmap("light.png", nullptr, {});
else
iconPixmapToSave = iconPixmap;
m_iconSavePath = targetPath.pathAppended(iconPath);
if (iconPixmap.isNull())
if (iconPixmapToSave.isNull())
model()->nodeInstanceView()->previewImageDataForGenericNode(node, {}, {}, EXPORT_ITEM_REQ_ID);
else
addIconAndCloseZip(iconPixmap);
addIconAndCloseZip(iconPixmapToSave);
}
void ContentLibraryView::addIconAndCloseZip(const auto &image) { // auto: QImage or QPixmap