QmlDesigner: Don't create duplicate default texture instance

Whenever an operation involving an asset image would result in
creation of a new texture node, it now checks first if
a matching texture node already exists and uses that instead.

Fixes: QDS-8435
Change-Id: I3d091aafcd09afdec897bc4da79789c1d84056e8
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2022-11-25 17:01:53 +02:00
parent 7d13c82750
commit 5544cdc276
5 changed files with 64 additions and 16 deletions

View File

@@ -435,6 +435,10 @@ void MaterialBrowserView::customNotification(const AbstractView *view,
int idx = m_widget->materialBrowserModel()->materialIndex(nodeList.first());
if (idx != -1)
m_widget->materialBrowserModel()->selectMaterial(idx);
} else if (identifier == "selected_texture_changed") {
int idx = m_widget->materialBrowserTexturesModel()->textureIndex(nodeList.first());
if (idx != -1)
m_widget->materialBrowserTexturesModel()->selectTexture(idx);
} else if (identifier == "refresh_material_browser") {
QTimer::singleShot(0, model(), [this]() {
refreshModel(true);