Commit 5be738e5 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.ItemLibrary: Allow non qrc source files

Source files can also be local files relative to the
.metainfo file.

Change-Id: I8b5519a1bf42808a1bfa744b7520fc910eb2aeac
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 5624232c
......@@ -188,10 +188,22 @@ void ItemLibraryEntry::setIconPath(const QString &iconPath)
m_data->iconPath = iconPath;
}
static QString getSourceForUrl(const QString &fileURl)
{
Utils::FileReader fileReader;
if (fileReader.fetch(fileURl)) {
return fileReader.data();
} else {
return Utils::FileReader::fetchQrc(fileURl);
}
}
void ItemLibraryEntry::setQml(const QString &qml)
{
m_data->qml = qml;
m_data->qmlSource = Utils::FileReader::fetchQrc(qml);
m_data->qmlSource = getSourceForUrl(qml);
}
void ItemLibraryEntry::setRequiredImport(const QString &requiredImport)
......
......@@ -255,7 +255,7 @@ void MetaInfoReader::readPropertyProperty(const QString &name, const QVariant &v
void MetaInfoReader::readQmlSourceProperty(const QString &name, const QVariant &value)
{
if (name == QLatin1String("source")) {
m_currentEntry.setQml(value.toString());
m_currentEntry.setQml(absoluteFilePathForDocument(value.toString()));
} else {
addError(tr("Unknown property for QmlSource %1").arg(name), currentSourceLocation());
setParserState(Error);
......
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