forked from qt-creator/qt-creator
QmlDesigner: Update texture preview when source change
Fixes: QDS-8386 Change-Id: Ifaa6effc040398452b022080257bbacbfb14efdf Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -164,6 +164,13 @@ void MaterialBrowserTexturesModel::deleteSelectedTexture()
|
||||
deleteTexture(m_selectedIndex);
|
||||
}
|
||||
|
||||
void MaterialBrowserTexturesModel::updateTextureSource(const ModelNode &texture)
|
||||
{
|
||||
int idx = textureIndex(texture);
|
||||
if (idx != -1)
|
||||
emit dataChanged(index(idx, 0), index(idx, 0), {roleNames().key("textureSource")});
|
||||
}
|
||||
|
||||
void MaterialBrowserTexturesModel::updateSelectedTexture()
|
||||
{
|
||||
selectTexture(m_selectedIndex, true);
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
void removeTexture(const ModelNode &texture);
|
||||
void deleteSelectedTexture();
|
||||
void updateSelectedTexture();
|
||||
void updateTextureSource(const ModelNode &texture);
|
||||
int textureIndex(const ModelNode &material) const;
|
||||
ModelNode textureAt(int idx) const;
|
||||
|
||||
|
||||
@@ -279,6 +279,8 @@ void MaterialBrowserView::variantPropertiesChanged(const QList<VariantProperty>
|
||||
|
||||
if (isMaterial(node) && property.name() == "objectName")
|
||||
m_widget->materialBrowserModel()->updateMaterialName(node);
|
||||
else if (isTexture(node) && property.name() == "source")
|
||||
m_widget->materialBrowserTexturesModel()->updateTextureSource(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user