forked from qt-creator/qt-creator
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: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user