forked from qt-creator/qt-creator
QmlJS: Get version numbers from components
If we have a pure QML plugin with a qmldir file, then the code model ends up without a version number. This is bad, since the version is required for graphical tooling. What we can do is to take the highest version number from all components that are defined in the plugin. Change-Id: Idb4206201efac91250100740e287676031d3016a Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
d550cbdd40
commit
3673ced26e
@@ -499,6 +499,14 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info)
|
||||
QRegExp safeName(QLatin1String("^[a-zA-Z_][[a-zA-Z0-9_]*$"));
|
||||
int majorVersion = LanguageUtils::ComponentVersion::NoVersion;
|
||||
int minorVersion = LanguageUtils::ComponentVersion::NoVersion;
|
||||
|
||||
foreach (const QmlDirParser::Component &component, info.components()) {
|
||||
if (component.majorVersion > majorVersion)
|
||||
majorVersion = component.majorVersion;
|
||||
if (component.minorVersion > minorVersion)
|
||||
minorVersion = component.minorVersion;
|
||||
}
|
||||
|
||||
if (vNr.indexIn(splitPath.last()) == 0) {
|
||||
splitPath.last() = vNr.cap(1);
|
||||
bool ok;
|
||||
|
Reference in New Issue
Block a user