diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 5f9cd189a1161948a10bfbbe54b38a82de533c2c..65b311bf40c2a2c820bef45d9af0553017d4f131 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -77,25 +77,30 @@ public: for (int index = 0; index < _metaObject->methodCount(); ++index) { QMetaMethod meth = _metaObject->method(index); - if (meth.methodType() != QMetaMethod::Signal) - continue; - if (meth.access() == QMetaMethod::Private) - continue; const QString signature = QString::fromUtf8(meth.signature()); - int indexOfParen = signature.indexOf(QLatin1Char('(')); + const 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); + const QString methodName = signature.left(indexOfParen); - processor->processSignal(signalName, engine()->undefinedValue()); // ### FIXME: assign a decent type to the signal - processor->processSlot(slotName, engine()->undefinedValue()); // ### FIXME: assign a decent type to the slot + if (meth.methodType() == QMetaMethod::Slot && meth.access() == QMetaMethod::Public) { + processor->processSlot(methodName, engine()->undefinedValue()); + + } else if (meth.methodType() == QMetaMethod::Signal && meth.access() != QMetaMethod::Private) { + // process the signal + processor->processSignal(methodName, engine()->undefinedValue()); // ### FIXME: assign a decent type to the signal + + QString slotName; + slotName += QLatin1String("on"); + slotName += methodName.at(0).toUpper(); + slotName += methodName.midRef(1); + + // process the generated slot + processor->processGeneratedSlot(slotName, engine()->undefinedValue()); // ### FIXME: assign a decent type to the slot + } } ObjectValue::processMembers(processor); @@ -584,6 +589,11 @@ bool MemberProcessor::processSlot(const QString &, const Value *) return true; } +bool MemberProcessor::processGeneratedSlot(const QString &, const Value *) +{ + return true; +} + ObjectValue::ObjectValue(Engine *engine) : _engine(engine), _prototype(0), _scope(0) { diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index b8bdb46d9fd1ef2ccadfa0edaa9a990c2a11f0bc..27a34806dd3b4b8c6aeed8efb3b9b6fd4c6195ad 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -205,6 +205,7 @@ public: virtual bool processProperty(const QString &name, const Value *value); virtual bool processSignal(const QString &name, const Value *value); virtual bool processSlot(const QString &name, const Value *value); + virtual bool processGeneratedSlot(const QString &name, const Value *value); }; class QMLJS_EXPORT ObjectValue: public Value, public Environment diff --git a/src/plugins/qmljseditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp index 820d14e49eaa8073936fc2752538dcbc59c9ebf0..45bfbe866a2a90999d06a8d7d399f2d9e30444f8 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.cpp +++ b/src/plugins/qmljseditor/qmlcodecompletion.cpp @@ -410,7 +410,21 @@ private: return true; } + virtual bool processSignal(const QString &name, const Interpreter::Value *value) + { + if (! _globalCompletion) + _properties.insert(name, value); + return true; + } + virtual bool processSlot(const QString &name, const Interpreter::Value *value) + { + if (! _globalCompletion) + _properties.insert(name, value); + return true; + } + + virtual bool processGeneratedSlot(const QString &name, const Interpreter::Value *value) { if (_globalCompletion) _properties.insert(name, value);