aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2024-04-15 17:06:17 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2024-04-15 15:14:06 +0000
commit21f6cbe4e42116d20f52cf35150eb66d5cb29b72 (patch)
treec8f97bc62a0fad956c46904e9ac4ed60d79fd0b7 /src/plugins/qmldesigner
parent3c13cf9493c250876bf91bb8f45255b7ef929ec0 (diff)
QmlDesigner: Adjust paths for new project structure
Before we used "content" but in the new project structure we will use "ProjectNameContent" to make the uri unique. First check for "content" to support older project. Keeping only the implementation in DocumentManager::currentResourcePath() Change-Id: Ib6b21f52c078fdb9a2ff31c02855754f83741538 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner')
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp5
-rw-r--r--src/plugins/qmldesigner/documentmanager.cpp7
2 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
index 8b41cfb692..66c1229a76 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
@@ -1138,10 +1138,7 @@ static QString getAssetDefaultDirectory(const QString &assetDir, const QString &
{
QString adjustedDefaultDirectory = defaultDirectory;
- Utils::FilePath contentPath = QmlDesignerPlugin::instance()->documentManager().currentProjectDirPath();
-
- if (contentPath.pathAppended("content").exists())
- contentPath = contentPath.pathAppended("content");
+ Utils::FilePath contentPath = QmlDesignerPlugin::instance()->documentManager().currentResourcePath();
Utils::FilePath assetPath = contentPath.pathAppended(assetDir);
diff --git a/src/plugins/qmldesigner/documentmanager.cpp b/src/plugins/qmldesigner/documentmanager.cpp
index 6d4deb527a..92d80680a9 100644
--- a/src/plugins/qmldesigner/documentmanager.cpp
+++ b/src/plugins/qmldesigner/documentmanager.cpp
@@ -544,6 +544,13 @@ Utils::FilePath DocumentManager::currentResourcePath()
if (contentFilePath.exists())
return contentFilePath;
+ const auto project = ProjectManager::startupProject();
+ const QString baseName = project->rootProjectDirectory().baseName() + "Content";
+
+ contentFilePath = resourcePath.pathAppended(baseName);
+ if (contentFilePath.exists())
+ return contentFilePath;
+
return resourcePath;
}