forked from qt-creator/qt-creator
QmlDesigner: Fix propertyGroups.json warning for 2D projects
Load property groups file only if Quick3D import exists Change-Id: Idf7b95cb4efa34dde6196964e5e2cbad54341193 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -128,14 +128,12 @@ void MaterialBrowserView::modelAttached(Model *model)
|
||||
{
|
||||
AbstractView::modelAttached(model);
|
||||
|
||||
QString matPropsPath = model->metaInfo("QtQuick3D.Material").importDirectoryPath()
|
||||
+ "/designer/propertyGroups.json";
|
||||
m_widget->materialBrowserModel()->loadPropertyGroups(matPropsPath);
|
||||
|
||||
m_widget->clearSearchFilter();
|
||||
m_widget->materialBrowserModel()->setHasMaterialRoot(rootModelNode().isSubclassOf("QtQuick3D.Material"));
|
||||
m_hasQuick3DImport = model->hasImport("QtQuick3D");
|
||||
|
||||
loadPropertyGroups();
|
||||
|
||||
// Project load is already very busy and may even trigger puppet reset, so let's wait a moment
|
||||
// before refreshing the model
|
||||
QTimer::singleShot(1000, this, [this]() {
|
||||
@@ -295,6 +293,16 @@ void MaterialBrowserView::nodeRemoved(const ModelNode &removedNode,
|
||||
m_widget->materialBrowserModel()->updateSelectedMaterial();
|
||||
}
|
||||
|
||||
void QmlDesigner::MaterialBrowserView::loadPropertyGroups()
|
||||
{
|
||||
if (!m_hasQuick3DImport || m_propertyGroupsLoaded)
|
||||
return;
|
||||
|
||||
QString matPropsPath = model()->metaInfo("QtQuick3D.Material").importDirectoryPath()
|
||||
+ "/designer/propertyGroups.json";
|
||||
m_propertyGroupsLoaded = m_widget->materialBrowserModel()->loadPropertyGroups(matPropsPath);
|
||||
}
|
||||
|
||||
void MaterialBrowserView::importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports)
|
||||
{
|
||||
Q_UNUSED(addedImports)
|
||||
@@ -307,6 +315,8 @@ void MaterialBrowserView::importsChanged(const QList<Import> &addedImports, cons
|
||||
|
||||
m_hasQuick3DImport = hasQuick3DImport;
|
||||
|
||||
loadPropertyGroups();
|
||||
|
||||
// Import change will trigger puppet reset, so we don't want to update previews immediately
|
||||
refreshModel(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user