Commit bf8c0b8a authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Complete signals, slots and generate slots of QML items.

parent 2a5506b1
......@@ -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)
{
......
......@@ -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
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment