From fef85f745f471e6910c14f1389429d2ac9fc6600 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 5 Jun 2013 11:57:24 +0200 Subject: [PATCH] QmlDesigner.PropertyEditor: Adding lookup rules for different versions The property editor will now try to find a pane for the specific version first. Example: If we have a QtQuick.Item 2.0 We first look for: QtQuick/ItemPane_2_0.qml And then fallback to: QtQuick/ItemPane.qml The same does apply for the specifics file. Task-number: QTCREATORBUG-8681 Change-Id: If210998780073295f168169d2fc424288d3bd6a0 Reviewed-by: Thomas Hartmann --- .../components/propertyeditor/propertyeditor.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index 1d071692e2e..abcf340489a 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -1087,6 +1087,22 @@ QString PropertyEditor::locateQmlFile(const NodeMetaInfo &info, const QString &r static QDir resourcesDir(resourcePropertyEditorPath); QDir importDir(info.importDirectoryPath() + QLatin1String(Constants::QML_DESIGNER_SUBFOLDER)); + const QString versionString = QLatin1String("_") + QString::number(info.majorVersion()) + + QLatin1String("_") + + QString::number(info.minorVersion()); + + QString relativePathWithoutEnding = relativePath; + relativePathWithoutEnding.chop(4); + const QString relativePathWithVersion = relativePathWithoutEnding + versionString + QLatin1String(".qml"); + + //Check for qml files with versions first + if (importDir.exists(relativePathWithVersion)) + return importDir.absoluteFilePath(relativePathWithVersion); + if (fileSystemDir.exists(relativePathWithVersion)) + return fileSystemDir.absoluteFilePath(relativePathWithVersion); + if (resourcesDir.exists(relativePathWithVersion)) + return resourcesDir.absoluteFilePath(relativePathWithVersion); + if (importDir.exists(relativePath)) return importDir.absoluteFilePath(relativePath); if (fileSystemDir.exists(relativePath))