forked from qt-creator/qt-creator
QmlDesigner: Do not register qml files that are part of imported 3D comp
Imported 3D components are handled via different code path, so they shouldn't be registered for item library in generic qml file registration. Fixes: QDS-4404 Change-Id: I840659301a63583bc66102c56de19924830f876b Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -318,7 +318,7 @@ void SubComponentManager::unregisterQmlFile(const QFileInfo &fileInfo, const QSt
|
|||||||
void SubComponentManager::registerQmlFile(const QFileInfo &fileInfo, const QString &qualifier,
|
void SubComponentManager::registerQmlFile(const QFileInfo &fileInfo, const QString &qualifier,
|
||||||
bool addToLibrary)
|
bool addToLibrary)
|
||||||
{
|
{
|
||||||
if (!model())
|
if (!addToLibrary || !model() || fileInfo.path().contains(QLatin1String(Constants::QUICK_3D_ASSETS_FOLDER)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString componentName = fileInfo.baseName();
|
QString componentName = fileInfo.baseName();
|
||||||
@@ -335,7 +335,6 @@ void SubComponentManager::registerQmlFile(const QFileInfo &fileInfo, const QStri
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SubComponentManager" << __FUNCTION__ << componentName;
|
qDebug() << "SubComponentManager" << __FUNCTION__ << componentName;
|
||||||
|
|
||||||
if (addToLibrary) {
|
|
||||||
// Add file components to the library
|
// Add file components to the library
|
||||||
ItemLibraryEntry itemLibraryEntry;
|
ItemLibraryEntry itemLibraryEntry;
|
||||||
itemLibraryEntry.setType(componentName.toUtf8());
|
itemLibraryEntry.setType(componentName.toUtf8());
|
||||||
@@ -344,13 +343,11 @@ void SubComponentManager::registerQmlFile(const QFileInfo &fileInfo, const QStri
|
|||||||
itemLibraryEntry.setCategory(ItemLibraryImport::userComponentsTitle());
|
itemLibraryEntry.setCategory(ItemLibraryImport::userComponentsTitle());
|
||||||
#endif
|
#endif
|
||||||
itemLibraryEntry.setCustomComponentSource(fileInfo.absoluteFilePath());
|
itemLibraryEntry.setCustomComponentSource(fileInfo.absoluteFilePath());
|
||||||
if (!qualifier.isEmpty()) {
|
if (!qualifier.isEmpty())
|
||||||
itemLibraryEntry.setRequiredImport(fixedQualifier);
|
itemLibraryEntry.setRequiredImport(fixedQualifier);
|
||||||
}
|
|
||||||
|
|
||||||
if (!model()->metaInfo().itemLibraryInfo()->containsEntry(itemLibraryEntry))
|
if (!model()->metaInfo().itemLibraryInfo()->containsEntry(itemLibraryEntry))
|
||||||
model()->metaInfo().itemLibraryInfo()->addEntries({itemLibraryEntry});
|
model()->metaInfo().itemLibraryInfo()->addEntries({itemLibraryEntry});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Model *SubComponentManager::model() const
|
Model *SubComponentManager::model() const
|
||||||
|
Reference in New Issue
Block a user