QmlDesigner: Fix path when importing a 3D model inside a component

Fixes: QDS-6319
Change-Id: Ia9dbdf9a2d32eaf996cca2ba84e89ca8111dab1c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2022-02-23 14:55:42 +02:00
parent 45364d4327
commit 787bbfaf1c

View File

@@ -128,11 +128,9 @@ ItemLibraryAssetImportDialog::ItemLibraryAssetImportDialog(
importPaths = model->importPaths(); importPaths = model->importPaths();
} }
QString targetDir = defaulTargetDirectory; QString targetDir = QmlDesignerPlugin::instance()->documentManager().currentProjectDirPath().toString();
if (targetDir.isEmpty())
ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::projectForFile(doc->fileName()); targetDir = defaulTargetDirectory;
if (currentProject)
targetDir = currentProject->projectDirectory().toString();
// Import is always done under known folder. The order of preference for folder is: // Import is always done under known folder. The order of preference for folder is:
// 1) An existing QUICK_3D_ASSETS_FOLDER under DEFAULT_ASSET_IMPORT_FOLDER project import path // 1) An existing QUICK_3D_ASSETS_FOLDER under DEFAULT_ASSET_IMPORT_FOLDER project import path