forked from qt-creator/qt-creator
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:
@@ -118,10 +118,6 @@ void MaterialBrowserView::modelAboutToBeDetached(Model *model)
|
||||
void MaterialBrowserView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||
const QList<ModelNode> &lastSelectedNodeList)
|
||||
{
|
||||
if (!m_autoSelectModelMaterial)
|
||||
return;
|
||||
|
||||
// if selected object is a model, select its material in the material browser and editor
|
||||
ModelNode selectedModel;
|
||||
|
||||
for (const ModelNode &node : selectedNodeList) {
|
||||
@@ -131,6 +127,11 @@ void MaterialBrowserView::selectedNodesChanged(const QList<ModelNode> &selectedN
|
||||
}
|
||||
}
|
||||
|
||||
m_widget->materialBrowserModel()->setHasModelSelection(selectedModel.isValid());
|
||||
|
||||
if (!m_autoSelectModelMaterial)
|
||||
return;
|
||||
|
||||
if (selectedNodeList.size() > 1 || !selectedModel.isValid())
|
||||
return;
|
||||
|
||||
@@ -144,6 +145,7 @@ void MaterialBrowserView::selectedNodesChanged(const QList<ModelNode> &selectedN
|
||||
if (!mat.isValid())
|
||||
return;
|
||||
|
||||
// if selected object is a model, select its material in the material browser and editor
|
||||
int idx = m_widget->materialBrowserModel()->materialIndex(mat);
|
||||
m_widget->materialBrowserModel()->selectMaterial(idx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user