QmlJS: Autocomplete dot and colon for properties.

Reviewed-by: Roberto Raggi
This commit is contained in:
Christian Kamm
2010-06-07 17:33:44 +02:00
parent d0d61182cb
commit 3b8b6e89cc
6 changed files with 98 additions and 67 deletions

View File

@@ -911,6 +911,23 @@ bool QmlObjectValue::enumContainsKey(const QString &enumName, const QString &enu
return false;
}
// Returns true if this object is in a package or if there is an object that
// has this one in its prototype chain and is itself in a package.
bool QmlObjectValue::hasChildInPackage() const
{
if (!packageName().isEmpty())
return true;
foreach (const FakeMetaObject *other, MetaTypeSystem::_metaObjects) {
if (other->packageName().isEmpty())
continue;
for (const FakeMetaObject *iter = other; iter; iter = iter->superClass()) {
if (iter == _metaObject) // this object is a parent of other
return true;
}
}
return false;
}
bool QmlObjectValue::isDerivedFrom(const FakeMetaObject *base) const
{
for (const FakeMetaObject *iter = _metaObject; iter; iter = iter->superClass()) {

View File

@@ -404,6 +404,7 @@ public:
bool isListProperty(const QString &name) const;
bool isEnum(const QString &typeName) const;
bool enumContainsKey(const QString &enumName, const QString &enumKeyName) const;
bool hasChildInPackage() const;
protected:
const Value *findOrCreateSignature(int index, const FakeMetaMethod &method, QString *methodName) const;
@@ -531,6 +532,8 @@ public:
private:
QHash<QString, QList<QmlObjectValue *> > _importedTypes;
friend class QmlObjectValue;
};
class ConvertToNumber: protected ValueVisitor // ECMAScript ToInt()