Commit 0fd0e6a9 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Make the project always return absolute import paths.

Task-number: QTCREATORBUG-1728
Reviewed-by: Kai Koehne
parent d2944d22
......@@ -10,6 +10,7 @@ class QmlProjectItemPrivate : public QObject {
public:
QString sourceDirectory;
QStringList importPaths;
QStringList absoluteImportPaths;
QList<QmlFileFilterItem*> qmlFileFilters() const;
......@@ -77,23 +78,34 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
}
}
setImportPaths(d->importPaths);
emit sourceDirectoryChanged();
}
QStringList QmlProjectItem::importPaths() const
{
Q_D(const QmlProjectItem);
return d->importPaths;
return d->absoluteImportPaths;
}
void QmlProjectItem::setImportPaths(const QStringList &importPaths)
{
Q_D(QmlProjectItem);
if (d->importPaths == importPaths)
if (d->importPaths != importPaths)
d->importPaths = importPaths;
// convert to absolute paths
QStringList absoluteImportPaths;
const QDir sourceDir(sourceDirectory());
foreach (const QString &importPath, importPaths)
absoluteImportPaths += QDir::cleanPath(sourceDir.absoluteFilePath(importPath));
if (d->absoluteImportPaths == absoluteImportPaths)
return;
d->importPaths = importPaths;
d->absoluteImportPaths = absoluteImportPaths;
emit importPathsChanged();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment