aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljsmodelmanagerinterface.h
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2016-03-18 17:43:33 +0100
committerUlf Hermann <[email protected]>2016-03-29 11:20:57 +0000
commit35bafd39529c7710f5be3142d0b23a89d36a3a61 (patch)
treeaa21a87a0fe22b8e30d52c28865f8063fdf32b66 /src/libs/qmljs/qmljsmodelmanagerinterface.h
parent9af85186e67d44417249da9325b0a65203e92201 (diff)
QmlJS: Fix resolution of "alias" directives in qrc files
Previously qrc paths of QML/JS documents were not considered for implicit imports. Only the path of the document in the file system was considered. The QML engine, however, doesn't know the original path at all and only uses the qrc paths for import resolution. This created a mismatch between what the QML engine could recognize and what the code model suggested. Without alias directives, any files imported from a qrc file would have to reside in the same directory as the one implicitly importing them, so this arrangement happened to work, most of the time. In order to support aliases we have to search the files in the same qrc path to figure out the imports. To do that, we keep a reverse map of qrc paths to files in the QrcParser and iterate that when resolving imports. Change-Id: I84baae6cbfbe96ddd5322c81494c1e4a3f473f3f Reviewed-by: Eike Ziller <[email protected]> Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/libs/qmljs/qmljsmodelmanagerinterface.h')
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h
index 690b178ec8a..ceeacc94f22 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.h
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h
@@ -153,6 +153,9 @@ public:
bool emitDocumentOnDiskChanged);
void fileChangedOnDisk(const QString &path);
void removeFiles(const QStringList &files);
+ QStringList qrcPathsForFile(const QString &file, const QLocale *locale = 0,
+ ProjectExplorer::Project *project = 0,
+ QrcResourceSelector resources = AllQrcResources);
QStringList filesAtQrcPath(const QString &path, const QLocale *locale = 0,
ProjectExplorer::Project *project = 0,
QrcResourceSelector resources = AllQrcResources);
@@ -250,6 +253,9 @@ protected:
private:
void cleanupFutures();
+ void iterateQrcFiles(ProjectExplorer::Project *project,
+ QrcResourceSelector resources,
+ std::function<void(QrcParser::ConstPtr)> callback);
mutable QMutex m_mutex;
QmlJS::Snapshot m_validSnapshot;