From d61cca8e0ad5a76eeece5936d918fe95c3a38e5e Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 10 Feb 2010 16:47:31 +0100 Subject: [PATCH] Show the generated slots in the completion box for the attached property `Keys'. --- src/plugins/qmljseditor/qmlcodecompletion.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmljseditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp index 6d1bb3f064f..15730f56604 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.cpp +++ b/src/plugins/qmljseditor/qmlcodecompletion.cpp @@ -158,11 +158,13 @@ class EnumerateProperties: private Interpreter::MemberProcessor QHash _properties; bool _globalCompletion; Interpreter::Context *_context; + const Interpreter::ObjectValue *_currentObject; public: EnumerateProperties(Interpreter::Context *context) : _globalCompletion(false), - _context(context) + _context(context), + _currentObject(0) { } @@ -175,6 +177,7 @@ public: { _processed.clear(); _properties.clear(); + _currentObject = Interpreter::value_cast(value); enumerateProperties(value); @@ -185,6 +188,7 @@ public: { _processed.clear(); _properties.clear(); + _currentObject = 0; foreach (const Interpreter::ObjectValue *scope, _context->scopeChain()) enumerateProperties(scope); @@ -227,8 +231,10 @@ private: virtual bool processGeneratedSlot(const QString &name, const Interpreter::Value *value) { - if (_globalCompletion) + if (_globalCompletion || (_currentObject && _currentObject->className().endsWith(QLatin1String("Keys")))) { + // ### FIXME: add support for attached properties. insertProperty(name, value); + } return true; }