forked from qt-creator/qt-creator
QmlDesigner.MetaInfo: cleanup and fix
Packages can be qualified by several ".". We have to take this into account. Change-Id: I5da0c624b464448dc6f16aaafa3ad3682f423ccc Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
@@ -782,6 +782,16 @@ static QString getUnqualifiedName(const QString &name)
|
|||||||
return nameComponents.last();
|
return nameComponents.last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString getPackage(const QString &name)
|
||||||
|
{
|
||||||
|
QStringList nameComponents = name.split('.');
|
||||||
|
if (nameComponents.size() < 2)
|
||||||
|
return QString();
|
||||||
|
nameComponents.removeLast();
|
||||||
|
|
||||||
|
return nameComponents.join(QLatin1String("."));
|
||||||
|
}
|
||||||
|
|
||||||
bool NodeMetaInfoPrivate::cleverCheckType(const QString &otherType) const
|
bool NodeMetaInfoPrivate::cleverCheckType(const QString &otherType) const
|
||||||
{
|
{
|
||||||
if (otherType == qualfiedTypeName())
|
if (otherType == qualfiedTypeName())
|
||||||
@@ -790,13 +800,9 @@ bool NodeMetaInfoPrivate::cleverCheckType(const QString &otherType) const
|
|||||||
if (isFileComponent())
|
if (isFileComponent())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QStringList split = otherType.split('.');
|
const QString typeName = getUnqualifiedName(otherType);
|
||||||
QString package;
|
const QString package = getPackage(otherType);
|
||||||
QString typeName = otherType;
|
|
||||||
if (split.count() > 1) {
|
|
||||||
package = split.first();
|
|
||||||
typeName = split.at(1);
|
|
||||||
}
|
|
||||||
if (cppPackageName() == package)
|
if (cppPackageName() == package)
|
||||||
return QString(package + '.' + typeName) == cppPackageName() + '.' + getUnqualifiedName(qualfiedTypeName());
|
return QString(package + '.' + typeName) == cppPackageName() + '.' + getUnqualifiedName(qualfiedTypeName());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user