forked from qt-creator/qt-creator
QmlDesigner: Fix bundle importing in project storage builds
In PS builds we can just change imports without waiting for new import to be included in possible imports if we know the import will be available. Also fix name generation of the imported bundle materials to match non-PS implementation. Task-number: QDS-14568 Task-number: QDS-14822 Change-Id: Ide9a7cafb8e2784c2c311695b5489eab267c0c04 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -124,6 +124,9 @@ QString BundleImporter::importComponent(const QString &bundleDir,
|
|||||||
data.fullReset = doReset;
|
data.fullReset = doReset;
|
||||||
|
|
||||||
Import import = Import::createLibraryImport(module, "1.0");
|
Import import = Import::createLibraryImport(module, "1.0");
|
||||||
|
#ifdef QDS_USE_PROJECTSTORAGE
|
||||||
|
model->changeImports({import}, {});
|
||||||
|
#else
|
||||||
if (!model->hasImport(import)) {
|
if (!model->hasImport(import)) {
|
||||||
if (model->possibleImports().contains(import)) {
|
if (model->possibleImports().contains(import)) {
|
||||||
try {
|
try {
|
||||||
@@ -138,6 +141,7 @@ QString BundleImporter::importComponent(const QString &bundleDir,
|
|||||||
data.importToAdd = module;
|
data.importToAdd = module;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
m_pendingImports.insert(type, data);
|
m_pendingImports.insert(type, data);
|
||||||
m_importTimerCount = 0;
|
m_importTimerCount = 0;
|
||||||
m_importTimer.start(normalImportDelay);
|
m_importTimer.start(normalImportDelay);
|
||||||
|
@@ -301,7 +301,7 @@ ModelNode createMaterial(AbstractView *view, const TypeName &typeName)
|
|||||||
matLib.defaultNodeListProperty().reparentHere(newMatNode);
|
matLib.defaultNodeListProperty().reparentHere(newMatNode);
|
||||||
|
|
||||||
static QRegularExpression rgx("([A-Z])([a-z]*)");
|
static QRegularExpression rgx("([A-Z])([a-z]*)");
|
||||||
QString newName = QString::fromUtf8(typeName).replace(rgx, " \\1\\2").trimmed();
|
QString newName = QString::fromUtf8(typeName.split('.').last()).replace(rgx, " \\1\\2").trimmed();
|
||||||
if (newName.endsWith(" Material"))
|
if (newName.endsWith(" Material"))
|
||||||
newName.chop(9); // remove trailing " Material"
|
newName.chop(9); // remove trailing " Material"
|
||||||
QString newId = view->model()->generateNewId(newName, "material");
|
QString newId = view->model()->generateNewId(newName, "material");
|
||||||
|
Reference in New Issue
Block a user