From e486a5a2af129e102257c07766bfbedc2f275ec6 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Tue, 6 Aug 2024 13:14:59 +0300 Subject: [PATCH] QmlDesigner: Consider texture name in Material Browser search Fixes: QDS-8414 Change-Id: I135827a3eb4c854908477c6189602b4f9ea9c431 Reviewed-by: Miikka Heikkinen Reviewed-by: Mahmoud Badri --- .../materialbrowsertexturesmodel.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp index 5903160a479..e34cc9825e3 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsertexturesmodel.cpp @@ -82,8 +82,17 @@ bool MaterialBrowserTexturesModel::isVisible(int idx) const if (!isValidIndex(idx)) return false; - return m_searchText.isEmpty() || m_textureList.at(idx).variantProperty("source") - .value().toString().contains(m_searchText, Qt::CaseInsensitive); + if (m_searchText.isEmpty()) + return true; + + const ModelNode &texture = m_textureList.at(idx); + + auto propertyHasMatch = [&](const PropertyName &property) -> bool { + return texture.variantProperty(property).value().toString().contains(m_searchText, + Qt::CaseInsensitive); + }; + + return propertyHasMatch("objectName") || propertyHasMatch("source"); } bool MaterialBrowserTexturesModel::isValidIndex(int idx) const