forked from qt-creator/qt-creator
QmlDesigner: Fix component file path
Change-Id: I9e5f5dc4906c9c498e4a54f92a7d8a105e0399a1 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
#include "qmlobjectnode.h"
|
#include "qmlobjectnode.h"
|
||||||
#include "variantproperty.h"
|
#include "variantproperty.h"
|
||||||
|
|
||||||
|
#include <model/modelutils.h>
|
||||||
|
|
||||||
#include <utils3d.h>
|
#include <utils3d.h>
|
||||||
|
|
||||||
#include <utils/expected.h>
|
#include <utils/expected.h>
|
||||||
@@ -292,7 +294,7 @@ bool BakeLightsDataModel::reset()
|
|||||||
|
|
||||||
if (!hasExposedProps && node.metaInfo().isFileComponent()
|
if (!hasExposedProps && node.metaInfo().isFileComponent()
|
||||||
&& node.metaInfo().isQtQuick3DNode()) {
|
&& node.metaInfo().isQtQuick3DNode()) {
|
||||||
const QString compFile = node.metaInfo().componentFileName();
|
const QString compFile = ModelUtils::componentFilePath(node);
|
||||||
const QString projPath = m_view->externalDependencies().currentProjectDirPath();
|
const QString projPath = m_view->externalDependencies().currentProjectDirPath();
|
||||||
if (compFile.startsWith(projPath)) {
|
if (compFile.startsWith(projPath)) {
|
||||||
// Quick and dirty scan of the component source to check if it potentially has
|
// Quick and dirty scan of the component source to check if it potentially has
|
||||||
|
@@ -27,9 +27,11 @@ QT_END_NAMESPACE
|
|||||||
# define DEPRECATED_VERSION_NUMBER \
|
# define DEPRECATED_VERSION_NUMBER \
|
||||||
[[deprecated( \
|
[[deprecated( \
|
||||||
"In most cases you don't need them anymore because the import is setting them!")]]
|
"In most cases you don't need them anymore because the import is setting them!")]]
|
||||||
|
# define DEPRECATED_COMPONENT_FILE_NAME [[deprecated("Use sourceId() instead.")]]
|
||||||
#else
|
#else
|
||||||
# define DEPRECATED_TYPENAME
|
# define DEPRECATED_TYPENAME
|
||||||
# define DEPRECATED_VERSION_NUMBER
|
# define DEPRECATED_VERSION_NUMBER
|
||||||
|
# define DEPRECATED_COMPONENT_FILE_NAME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -116,7 +118,7 @@ public:
|
|||||||
Storage::Info::ItemLibraryEntries itemLibrariesEntries() const;
|
Storage::Info::ItemLibraryEntries itemLibrariesEntries() const;
|
||||||
|
|
||||||
SourceId sourceId() const;
|
SourceId sourceId() const;
|
||||||
QString componentFileName() const;
|
DEPRECATED_COMPONENT_FILE_NAME QString componentFileName() const;
|
||||||
|
|
||||||
bool isBasedOn(const NodeMetaInfo &metaInfo) const;
|
bool isBasedOn(const NodeMetaInfo &metaInfo) const;
|
||||||
bool isBasedOn(const NodeMetaInfo &metaInfo1, const NodeMetaInfo &metaInfo2) const;
|
bool isBasedOn(const NodeMetaInfo &metaInfo1, const NodeMetaInfo &metaInfo2) const;
|
||||||
|
@@ -109,19 +109,19 @@ PropertyMetaInfo metainfo(const ModelNode &node, const PropertyName &propertyNam
|
|||||||
return node.metaInfo().property(propertyName);
|
return node.metaInfo().property(propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString componentFilePath(const PathCacheType &pathCache, const NodeMetaInfo &metaInfo)
|
QString componentFilePath([[maybe_unused]] const PathCacheType &pathCache, const NodeMetaInfo &metaInfo)
|
||||||
{
|
{
|
||||||
if constexpr (useProjectStorage()) {
|
#ifdef QDS_USE_PROJECTSTORAGE
|
||||||
auto typeSourceId = metaInfo.sourceId();
|
auto typeSourceId = metaInfo.sourceId();
|
||||||
|
|
||||||
if (typeSourceId && metaInfo.isFileComponent()) {
|
if (typeSourceId && metaInfo.isFileComponent()) {
|
||||||
return pathCache.sourcePath(typeSourceId).toQString();
|
return pathCache.sourcePath(typeSourceId).toQString();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return metaInfo.componentFileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
#else
|
||||||
|
return metaInfo.componentFileName();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString componentFilePath(const ModelNode &node)
|
QString componentFilePath(const ModelNode &node)
|
||||||
|
@@ -130,7 +130,7 @@ static void openComponentSourcePropertyOfLoader(const ModelNode &modelNode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Core::EditorManager::openEditor(FilePath::fromString(
|
Core::EditorManager::openEditor(FilePath::fromString(
|
||||||
componentModelNode.metaInfo().componentFileName()),
|
ModelUtils::componentFilePath(componentModelNode)),
|
||||||
Utils::Id(),
|
Utils::Id(),
|
||||||
Core::EditorManager::DoNotMakeVisible);
|
Core::EditorManager::DoNotMakeVisible);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user