forked from qt-creator/qt-creator
QmlDesigner: Update textures sources on state change
Also small relevant fixes. Fixes: QDS-8523 Change-Id: I8125b124024ee18de8c70afbc9f633c3b9265e82 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -33,7 +33,7 @@ QVariant MaterialBrowserTexturesModel::data(const QModelIndex &index, int role)
|
||||
|
||||
QByteArray roleName = roleNames().value(role);
|
||||
if (roleName == "textureSource") {
|
||||
QString source = m_textureList.at(index.row()).variantProperty("source").value().toString();
|
||||
QString source = QmlObjectNode(m_textureList.at(index.row())).modelValue("source").toString();
|
||||
if (source.isEmpty())
|
||||
return {};
|
||||
if (Utils::FilePath::fromString(source).isAbsolutePath())
|
||||
@@ -184,6 +184,11 @@ void MaterialBrowserTexturesModel::updateTextureSource(const ModelNode &texture)
|
||||
emit dataChanged(index(idx, 0), index(idx, 0), {roleNames().key("textureSource")});
|
||||
}
|
||||
|
||||
void MaterialBrowserTexturesModel::updateAllTexturesSources()
|
||||
{
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, 0), {roleNames().key("textureSource")});
|
||||
}
|
||||
|
||||
void MaterialBrowserTexturesModel::updateSelectedTexture()
|
||||
{
|
||||
selectTexture(m_selectedIndex, true);
|
||||
@@ -205,6 +210,11 @@ ModelNode MaterialBrowserTexturesModel::textureAt(int idx) const
|
||||
return {};
|
||||
}
|
||||
|
||||
ModelNode MaterialBrowserTexturesModel::selectedTexture() const
|
||||
{
|
||||
return textureAt(m_selectedIndex);
|
||||
}
|
||||
|
||||
bool MaterialBrowserTexturesModel::hasSingleModelSelection() const
|
||||
{
|
||||
return m_hasSingleModelSelection;
|
||||
|
||||
Reference in New Issue
Block a user