Commit 8bf08f01 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.nodeInstances: stricter checking for component paths

We only fix component path if it contains "/imports/".

Change-Id: I4624c460a7475c6b659baea011e2d37def4fdca2
Reviewed-on: http://codereview.qt.nokia.com/1457

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent b273c663
......@@ -769,15 +769,16 @@ QObject *ObjectNodeInstance::createComponentWrap(const QString &nodeSource, cons
return object;
}
//The component might also be shipped with Creator.
//To avoid trouble with import "." we use the component shipped with Creator.
static inline QString fixComponentPathForIncompatibleQt(const QString &componentPath)
{
QString result = componentPath;
const QLatin1String importString("import");
const QLatin1String importString("/imports/");
if (componentPath.contains(importString)) {
int index = componentPath.indexOf(importString) + 7;
int index = componentPath.indexOf(importString) + 8;
const QString relativeImportPath = componentPath.right(componentPath.length() - index);
QString fixedComponentPath = QLibraryInfo::location(QLibraryInfo::ImportsPath) + relativeImportPath;
fixedComponentPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
......@@ -786,7 +787,6 @@ static inline QString fixComponentPathForIncompatibleQt(const QString &component
}
return result;
}
QObject *ObjectNodeInstance::createComponent(const QString &componentPath, QDeclarativeContext *context)
......
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