diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2024-04-25 18:36:24 +0300 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2024-04-26 10:20:17 +0000 |
commit | ccf0a68c42875f5c5d6bbf4d128e315f48f3e03b (patch) | |
tree | 0dc7ae262c96a332bee6a36fc74d08627e54280c | |
parent | 17a28ea850604af6e4cf84d5b3a7198d2d03280f (diff) |
QmlDesigner: Fix bundle material instance not removed
after removing a bundle material from project
Fixes: QDS-12527
Change-Id: I72b4d99d15a6fbd454d45bdf0ba1a1b469e1a5bb
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
3 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp index 26747d359c..dd032a6d1f 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp @@ -40,7 +40,10 @@ ContentLibraryMaterialsModel::ContentLibraryMaterialsModel(ContentLibraryWidget qmlRegisterType<QmlDesigner::FileDownloader>("WebFetcher", 1, 0, "FileDownloader"); qmlRegisterType<QmlDesigner::MultiFileDownloader>("WebFetcher", 1, 0, "MultiFileDownloader"); +} +void ContentLibraryMaterialsModel::loadBundle() +{ QDir bundleDir{m_downloadPath}; if (fetchBundleMetadata(bundleDir) && fetchBundleIcons(bundleDir)) loadMaterialBundle(bundleDir); diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h index 21bd374137..a2c2e90ce1 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h @@ -51,6 +51,7 @@ public: void resetModel(); void updateIsEmpty(); + void loadBundle(); Internal::ContentLibraryBundleImporter *bundleImporter() const; diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp index 1e0b69099b..9cbc0f7339 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp @@ -290,7 +290,6 @@ void ContentLibraryView::modelAttached(Model *model) m_hasQuick3DImport = model->hasImport("QtQuick3D"); updateBundlesQuick3DVersion(); - updateBundleMaterialsImportedState(); const bool hasLibrary = Utils3D::materialLibraryNode(this).isValid(); m_widget->setHasMaterialLibrary(hasLibrary); @@ -302,11 +301,16 @@ void ContentLibraryView::modelAttached(Model *model) m_widget->setHasActive3DScene(m_sceneId != -1); m_widget->clearSearchFilter(); + // bundles loading has to happen here, otherwise project path is not ready which will + // cause bundle items types to resolve incorrectly + m_widget->materialsModel()->loadBundle(); m_widget->effectsModel()->loadBundle(); - updateBundleEffectsImportedState(); - m_widget->userModel()->loadMaterialBundle(); m_widget->userModel()->loadTextureBundle(); + + updateBundleMaterialsImportedState(); + updateBundleEffectsImportedState(); + updateBundleUserMaterialsImportedState(); } void ContentLibraryView::modelAboutToBeDetached(Model *model) |