QmlDesigner: Disable apply material to selected when no selection exist

When there is no valid model selected, disable the "apply to selected"
actions in the material editor and browser.

Change-Id: Id8e771c64e69c0ba2f42dff01d19ffbf4afafb77
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2022-05-24 14:14:14 +03:00
parent c5818fc844
commit 71e553f497
8 changed files with 52 additions and 12 deletions

View File

@@ -106,6 +106,20 @@ void MaterialBrowserModel::setHasQuick3DImport(bool b)
emit hasQuick3DImportChanged();
}
bool MaterialBrowserModel::hasModelSelection() const
{
return m_hasModelSelection;
}
void MaterialBrowserModel::setHasModelSelection(bool b)
{
if (b == m_hasModelSelection)
return;
m_hasModelSelection = b;
emit hasModelSelectionChanged();
}
void MaterialBrowserModel::setSearchText(const QString &searchText)
{
QString lowerSearchText = searchText.toLower();
@@ -156,11 +170,7 @@ void MaterialBrowserModel::setMaterials(const QList<ModelNode> &materials, bool
emit isEmptyChanged();
}
if (hasQuick3DImport != m_hasQuick3DImport) {
m_hasQuick3DImport = hasQuick3DImport;
emit hasQuick3DImportChanged();
}
setHasQuick3DImport(hasQuick3DImport);
updateSelectedMaterial();
resetModel();
}