QmlDesigner: Don't create material library node in in-file component

While there are some valid use cases for having a material library
inside in-file component, having duplicate material library nodes
in a single file causes some issues that are not trivial to solve,
so for now we just prevent this from happening.

Fixes: QDS-8656
Change-Id: I4495ea4d972eab76ca444d18ab4c45b403805ad7
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Miikka Heikkinen
2023-01-31 14:08:16 +02:00
parent 770463877c
commit c14ec1b4c1
2 changed files with 8 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
#include <auxiliarydataproperties.h>
#include <bindingproperty.h>
#include <designdocument.h>
#include <dynamicpropertiesmodel.h>
#include <metainfo.h>
#include <nodeinstanceview.h>
@@ -60,6 +61,8 @@ MaterialEditorView::MaterialEditorView(ExternalDependenciesInterface &externalDe
m_ensureMatLibTimer.callOnTimeout([this] {
if (model() && model()->rewriterView() && !model()->rewriterView()->hasIncompleteTypeInformation()
&& model()->rewriterView()->errors().isEmpty()) {
DesignDocument *doc = QmlDesignerPlugin::instance()->currentDesignDocument();
if (doc && !doc->inFileComponentModelActive())
ensureMaterialLibraryNode();
if (m_qmlBackEnd && m_qmlBackEnd->contextObject())
m_qmlBackEnd->contextObject()->setHasMaterialLibrary(materialLibraryNode().isValid());

View File

@@ -28,6 +28,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <designdocument.h>
#include <designmodewidget.h>
#include <propertyeditorqmlbackend.h>
#include <utils/environment.h>
@@ -62,6 +63,8 @@ TextureEditorView::TextureEditorView(AsynchronousImageCache &imageCache,
m_ensureMatLibTimer.callOnTimeout([this] {
if (model() && model()->rewriterView() && !model()->rewriterView()->hasIncompleteTypeInformation()
&& model()->rewriterView()->errors().isEmpty()) {
DesignDocument *doc = QmlDesignerPlugin::instance()->currentDesignDocument();
if (doc && !doc->inFileComponentModelActive())
ensureMaterialLibraryNode();
if (m_qmlBackEnd && m_qmlBackEnd->contextObject())
m_qmlBackEnd->contextObject()->setHasMaterialLibrary(materialLibraryNode().isValid());