From 7ec0a8d8899863883c05e2c72622e2c652de9e5d Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 7 Jul 2015 14:00:45 +0200 Subject: [PATCH] QmlDesigner: take version into account when looking up specifics Change-Id: I074a2930b5d0cfee6444ee4df6f0d2e06a8ecc54 Reviewed-by: J-P Nurmi --- .../propertyeditor/propertyeditorqmlbackend.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 62a10188816..4b466aa2230 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -473,6 +473,7 @@ QString PropertyEditorQmlBackend::locateQmlFile(const NodeMetaInfo &info, const static QDir resourcesDir(QStringLiteral(":/propertyEditorQmlSources")); QDir importDir(info.importDirectoryPath() + QLatin1String(Constants::QML_DESIGNER_SUBFOLDER)); + QDir importDirVersion(info.importDirectoryPath() + QStringLiteral(".") + QString::number(info.majorVersion()) + QLatin1String(Constants::QML_DESIGNER_SUBFOLDER)); const QString versionString = QStringLiteral("_") + QString::number(info.majorVersion()) + QStringLiteral("_") @@ -484,6 +485,14 @@ QString PropertyEditorQmlBackend::locateQmlFile(const NodeMetaInfo &info, const //Check for qml files with versions first const QString withoutDirWithVersion = relativePathWithVersion.split(QStringLiteral("/")).last(); + + const QString withoutDir = relativePath.split(QStringLiteral("/")).last(); + + if (importDirVersion.exists(withoutDir)) + return importDirVersion.absoluteFilePath(withoutDir); + + + if (importDir.exists(relativePathWithVersion)) return importDir.absoluteFilePath(relativePathWithVersion); if (importDir.exists(withoutDirWithVersion)) //Since we are in a subfolder of the import we do not require the directory @@ -493,7 +502,7 @@ QString PropertyEditorQmlBackend::locateQmlFile(const NodeMetaInfo &info, const if (resourcesDir.exists(relativePathWithVersion)) return resourcesDir.absoluteFilePath(relativePathWithVersion); - const QString withoutDir = relativePath.split(QStringLiteral("/")).last(); + if (importDir.exists(relativePath)) return importDir.absoluteFilePath(relativePath); if (importDir.exists(withoutDir)) //Since we are in a subfolder of the import we do not require the directory