diff options
-rw-r--r-- | src/script/api/qscriptengine.cpp | 19 | ||||
-rw-r--r-- | src/script/api/qscriptengine_p.h | 8 | ||||
-rw-r--r-- | src/script/bridge/qscriptqobject.cpp | 13 | ||||
-rw-r--r-- | src/script/bridge/qscriptqobject_p.h | 3 |
4 files changed, 26 insertions, 17 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 9abc5da..36f0f44 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -611,7 +611,7 @@ JSC::JSValue functionConnect(JSC::ExecState *exec, JSC::JSObject */*callee*/, JS return JSC::throwError(exec, JSC::TypeError, "Function.prototype.connect: target is not a function"); } - bool ok = engine->scriptConnect(thisObject, receiver, slot); + bool ok = engine->scriptConnect(thisObject, receiver, slot, Qt::AutoConnection); if (!ok) { QString message = QString::fromLatin1("Function.prototype.connect: failed to connect to %0::%1") .arg(QLatin1String(qtSignal->metaObject()->className())) @@ -1273,7 +1273,8 @@ void QScriptEnginePrivate::emitSignalHandlerException() } bool QScriptEnginePrivate::scriptConnect(QObject *sender, const char *signal, - JSC::JSValue receiver, JSC::JSValue function) + JSC::JSValue receiver, JSC::JSValue function, + Qt::ConnectionType type) { Q_ASSERT(sender); Q_ASSERT(signal); @@ -1281,7 +1282,7 @@ bool QScriptEnginePrivate::scriptConnect(QObject *sender, const char *signal, int index = meta->indexOfSignal(QMetaObject::normalizedSignature(signal+1)); if (index == -1) return false; - return scriptConnect(sender, index, receiver, function, /*wrapper=*/JSC::JSValue()); + return scriptConnect(sender, index, receiver, function, /*wrapper=*/JSC::JSValue(), type); } bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, const char *signal, @@ -1298,10 +1299,11 @@ bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, const char *signal, bool QScriptEnginePrivate::scriptConnect(QObject *sender, int signalIndex, JSC::JSValue receiver, JSC::JSValue function, - JSC::JSValue senderWrapper) + JSC::JSValue senderWrapper, + Qt::ConnectionType type) { QScript::QObjectData *data = qobjectData(sender); - return data->addSignalHandler(sender, signalIndex, receiver, function, senderWrapper); + return data->addSignalHandler(sender, signalIndex, receiver, function, senderWrapper, type); } bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, int signalIndex, @@ -1314,11 +1316,11 @@ bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, int signalIndex, } bool QScriptEnginePrivate::scriptConnect(JSC::JSValue signal, JSC::JSValue receiver, - JSC::JSValue function) + JSC::JSValue function, Qt::ConnectionType type) { QScript::QtFunction *fun = static_cast<QScript::QtFunction*>(JSC::asObject(signal)); int index = fun->mostGeneralMethod(); - return scriptConnect(fun->qobject(), index, receiver, function, fun->wrapperObject()); + return scriptConnect(fun->qobject(), index, receiver, function, fun->wrapperObject(), type); } bool QScriptEnginePrivate::scriptDisconnect(JSC::JSValue signal, JSC::JSValue receiver, @@ -3453,7 +3455,8 @@ bool qScriptConnect(QObject *sender, const char *signal, QScriptEnginePrivate *engine = QScriptEnginePrivate::get(function.engine()); JSC::JSValue jscReceiver = engine->scriptValueToJSCValue(receiver); JSC::JSValue jscFunction = engine->scriptValueToJSCValue(function); - return engine->scriptConnect(sender, signal, jscReceiver, jscFunction); + return engine->scriptConnect(sender, signal, jscReceiver, jscFunction, + Qt::AutoConnection); } /*! diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 614341b..77c4561 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -178,18 +178,20 @@ public: void emitSignalHandlerException(); bool scriptConnect(QObject *sender, const char *signal, - JSC::JSValue receiver, JSC::JSValue function); + JSC::JSValue receiver, JSC::JSValue function, + Qt::ConnectionType type); bool scriptDisconnect(QObject *sender, const char *signal, JSC::JSValue receiver, JSC::JSValue function); bool scriptConnect(QObject *sender, int index, JSC::JSValue receiver, JSC::JSValue function, - JSC::JSValue senderWrapper = 0); + JSC::JSValue senderWrapper, + Qt::ConnectionType type); bool scriptDisconnect(QObject *sender, int index, JSC::JSValue receiver, JSC::JSValue function); bool scriptConnect(JSC::JSValue signal, JSC::JSValue receiver, - JSC::JSValue function); + JSC::JSValue function, Qt::ConnectionType type); bool scriptDisconnect(JSC::JSValue signal, JSC::JSValue receiver, JSC::JSValue function); diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 892ca5b..e876cc9 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -141,7 +141,8 @@ public: bool addSignalHandler(QObject *sender, int signalIndex, JSC::JSValue receiver, JSC::JSValue slot, - JSC::JSValue senderWrapper = 0); + JSC::JSValue senderWrapper, + Qt::ConnectionType type); bool removeSignalHandler(QObject *sender, int signalIndex, JSC::JSValue receiver, JSC::JSValue slot); @@ -2090,13 +2091,14 @@ void QObjectConnectionManager::mark() bool QObjectConnectionManager::addSignalHandler( QObject *sender, int signalIndex, JSC::JSValue receiver, - JSC::JSValue function, JSC::JSValue senderWrapper) + JSC::JSValue function, JSC::JSValue senderWrapper, + Qt::ConnectionType type) { if (connections.size() <= signalIndex) connections.resize(signalIndex+1); QVector<QObjectConnection> &cs = connections[signalIndex]; int absSlotIndex = slotCounter + metaObject()->methodOffset(); - bool ok = QMetaObject::connect(sender, signalIndex, this, absSlotIndex); + bool ok = QMetaObject::connect(sender, signalIndex, this, absSlotIndex, type); if (ok) { cs.append(QObjectConnection(slotCounter++, receiver, function, senderWrapper)); QMetaMethod signal = sender->metaObject()->method(signalIndex); @@ -2168,12 +2170,13 @@ bool QObjectData::addSignalHandler(QObject *sender, int signalIndex, JSC::JSValue receiver, JSC::JSValue slot, - JSC::JSValue senderWrapper) + JSC::JSValue senderWrapper, + Qt::ConnectionType type) { if (!connectionManager) connectionManager = new QObjectConnectionManager(engine); return connectionManager->addSignalHandler( - sender, signalIndex, receiver, slot, senderWrapper); + sender, signalIndex, receiver, slot, senderWrapper, type); } bool QObjectData::removeSignalHandler(QObject *sender, diff --git a/src/script/bridge/qscriptqobject_p.h b/src/script/bridge/qscriptqobject_p.h index cce585f..72e5028 100644 --- a/src/script/bridge/qscriptqobject_p.h +++ b/src/script/bridge/qscriptqobject_p.h @@ -168,7 +168,8 @@ public: int signalIndex, JSC::JSValue receiver, JSC::JSValue slot, - JSC::JSValue senderWrapper = 0); + JSC::JSValue senderWrapper, + Qt::ConnectionType type); bool removeSignalHandler(QObject *sender, int signalIndex, JSC::JSValue receiver, |