From 0f254adcc3c627e52382dbb3b56a9baa754ab825 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 22 Jun 2011 17:18:06 +0200 Subject: [PATCH] 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: Roberto Raggi --- src/libs/qmljs/qmljsinterpreter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 2369e4d55d..be500a0ae5 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -446,18 +446,18 @@ QStringList QmlObjectValue::keysForEnum(const QString &enumName) const // has this one in its prototype chain and is itself in a package. bool QmlObjectValue::hasChildInPackage() const { - if (!packageName().isEmpty()) + if (!packageName().isEmpty() + && packageName() != CppQmlTypes::cppPackage) return true; QHashIterator it(engine()->cppQmlTypes().types()); while (it.hasNext()) { it.next(); - FakeMetaObject::ConstPtr other = it.value()->_metaObject; - // if it has only the default no-package export, it is not really exported - if (other->exports().size() <= 1) + FakeMetaObject::ConstPtr otherMeta = it.value()->_metaObject; + // if it has only a cpp-package export, it is not really exported + if (otherMeta->exports().size() <= 1) continue; - for (const QmlObjectValue *it = this; it; it = it->prototype()) { - FakeMetaObject::ConstPtr iter = it->_metaObject; - if (iter == _metaObject) // this object is a parent of other + for (const QmlObjectValue *other = it.value(); other; other = other->prototype()) { + if (other->metaObject() == _metaObject) // this object is a parent of other return true; } } -- 2.11.0