Commit 0f254adc authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Fix completion of 'anchors.'.

The hasChildInPackage function was broken, so we completed 'anchors:'
instead.

Task-number: QTCREATORBUG-5180
Change-Id: I0e0d68aec3cf4e5bea991e39169beecf541ce477
Reviewed-on: http://codereview.qt.nokia.com/643

Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent 756e00b1
...@@ -446,18 +446,18 @@ QStringList QmlObjectValue::keysForEnum(const QString &enumName) const ...@@ -446,18 +446,18 @@ QStringList QmlObjectValue::keysForEnum(const QString &enumName) const
// has this one in its prototype chain and is itself in a package. // has this one in its prototype chain and is itself in a package.
bool QmlObjectValue::hasChildInPackage() const bool QmlObjectValue::hasChildInPackage() const
{ {
if (!packageName().isEmpty()) if (!packageName().isEmpty()
&& packageName() != CppQmlTypes::cppPackage)
return true; return true;
QHashIterator<QString, QmlObjectValue *> it(engine()->cppQmlTypes().types()); QHashIterator<QString, QmlObjectValue *> it(engine()->cppQmlTypes().types());
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
FakeMetaObject::ConstPtr other = it.value()->_metaObject; FakeMetaObject::ConstPtr otherMeta = it.value()->_metaObject;
// if it has only the default no-package export, it is not really exported // if it has only a cpp-package export, it is not really exported
if (other->exports().size() <= 1) if (otherMeta->exports().size() <= 1)
continue; continue;
for (const QmlObjectValue *it = this; it; it = it->prototype()) { for (const QmlObjectValue *other = it.value(); other; other = other->prototype()) {
FakeMetaObject::ConstPtr iter = it->_metaObject; if (other->metaObject() == _metaObject) // this object is a parent of other
if (iter == _metaObject) // this object is a parent of other
return true; return true;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment