summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-08-14 15:36:54 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2018-08-15 07:43:25 +0000
commit6fcf5b4fe31f0411c1ee2449726860d49e1d3c1a (patch)
tree84944fea6938ebe2d0ad2d87d210c63cf1078217 /src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
parentad1a2b5335ca2c021bedc6b8c8c2b93bb8460726 (diff)
Display import path for groups as relative to project
Previously the path was relative to presentation, which typically meant it was always prefixed with ../, which is not visually nice and might be confusing. Task-number: QT3DS-2056 Change-Id: I51816bc3f5e260f48ffbf0c2df7815356eed0db5 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp')
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index 771f229d..fbe799b2 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -54,6 +54,7 @@
#include "MainFrm.h"
#include "DataInputDlg.h"
#include "Dialogs.h"
+#include "ProjectFile.h"
#include <QtCore/qtimer.h>
#include <QtQml/qqmlcontext.h>
@@ -549,6 +550,18 @@ bool InspectorControlView::toolTipsEnabled()
return CStudioPreferences::ShouldShowTooltips();
}
+// Converts a path that is relative to the current presentation to be relative to
+// the current project root
+QString InspectorControlView::convertPathToProjectRoot(const QString &presentationPath)
+{
+ QDir projDir(g_StudioApp.GetCore()->getProjectFile().getProjectPath());
+ QFileInfo presentationFile(g_StudioApp.GetCore()->GetDoc()->GetDocumentPath()
+ .GetAbsolutePath().toQString());
+ QDir presentationDir(presentationFile.absolutePath());
+ QString absPath = presentationDir.absoluteFilePath(presentationPath);
+ return projDir.relativeFilePath(absPath);
+}
+
void InspectorControlView::OnBeginDataModelNotifications()
{