From a8f0971a0be998d688e70f087cac6b2ddda78ecc Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Mon, 25 Jan 2010 14:48:44 +0100
Subject: [PATCH] Show the auto-created slots in the completion box (e.g.
 MouseRegion's onClicked).

---
 src/libs/qmljs/qmljsinterpreter.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index 6f52196afb4..049496c217e 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -74,6 +74,23 @@ public:
 
             processor->process(prop.name(), propertyValue(prop));
         }
+
+        for (int index = 0; index < _metaObject->methodCount(); ++index) {
+            QMetaMethod meth = _metaObject->method(index);
+            const QString signature = QString::fromUtf8(meth.signature());
+
+            int indexOfParen = signature.indexOf(QLatin1Char('('));
+            if (indexOfParen == -1)
+                continue; // skip it, invalid signature.
+
+            const QString signalName = signature.left(indexOfParen);
+            QString slotName;
+            slotName += QLatin1String("on");
+            slotName += signalName.at(0).toUpper();
+            slotName += signalName.midRef(1);
+            processor->process(slotName, engine()->undefinedValue()); // ### FIXME: assign a decent type to the property
+        }
+
     }
 
     const Value *propertyValue(const QMetaProperty &prop) const {
-- 
GitLab