summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/qscriptecmafunction.cpp2
-rw-r--r--src/script/qscriptengine.cpp3
-rw-r--r--src/script/qscriptengine_p.cpp15
-rw-r--r--src/script/qscriptenginefwd_p.h9
-rw-r--r--src/script/qscriptextqobject.cpp13
-rw-r--r--src/script/qscriptextqobject_p.h3
6 files changed, 28 insertions, 17 deletions
diff --git a/src/script/qscriptecmafunction.cpp b/src/script/qscriptecmafunction.cpp
index 87b0639..0bb5f12 100644
--- a/src/script/qscriptecmafunction.cpp
+++ b/src/script/qscriptecmafunction.cpp
@@ -436,7 +436,7 @@ QScriptValueImpl Function::method_connect(QScriptContextPrivate *context, QScrip
QLatin1String("Function.prototype.connect: target is not a function"));
}
- bool ok = eng->scriptConnect(self, receiver, slot);
+ bool ok = eng->scriptConnect(self, receiver, slot, Qt::AutoConnection);
if (!ok) {
return context->throwError(
QString::fromLatin1("Function.prototype.connect: failed to connect to %0::%1")
diff --git a/src/script/qscriptengine.cpp b/src/script/qscriptengine.cpp
index de8bd8d..de78403 100644
--- a/src/script/qscriptengine.cpp
+++ b/src/script/qscriptengine.cpp
@@ -1616,7 +1616,8 @@ bool qScriptConnect(QObject *sender, const char *signal,
QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(function.engine());
return eng_p->scriptConnect(sender, signal,
eng_p->toImpl(receiver),
- eng_p->toImpl(function));
+ eng_p->toImpl(function),
+ Qt::AutoConnection);
}
/*!
diff --git a/src/script/qscriptengine_p.cpp b/src/script/qscriptengine_p.cpp
index 0a238bc..ffb5a27 100644
--- a/src/script/qscriptengine_p.cpp
+++ b/src/script/qscriptengine_p.cpp
@@ -2312,7 +2312,8 @@ void QScriptEnginePrivate::deletePendingQObjects()
bool QScriptEnginePrivate::scriptConnect(QObject *sender, const char *signal,
const QScriptValueImpl &receiver,
- const QScriptValueImpl &function)
+ const QScriptValueImpl &function,
+ Qt::ConnectionType type)
{
Q_ASSERT(sender);
Q_ASSERT(signal);
@@ -2320,7 +2321,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);
+ return scriptConnect(sender, index, receiver, function, /*wrapper=*/QScriptValueImpl(), type);
}
bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, const char *signal,
@@ -2339,10 +2340,11 @@ bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, const char *signal,
bool QScriptEnginePrivate::scriptConnect(QObject *sender, int signalIndex,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function,
- const QScriptValueImpl &senderWrapper)
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type)
{
QScriptQObjectData *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,
@@ -2357,11 +2359,12 @@ bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, int signalIndex,
bool QScriptEnginePrivate::scriptConnect(const QScriptValueImpl &signal,
const QScriptValueImpl &receiver,
- const QScriptValueImpl &function)
+ const QScriptValueImpl &function,
+ Qt::ConnectionType type)
{
QScript::QtFunction *fun = static_cast<QScript::QtFunction*>(signal.toFunction());
int index = fun->mostGeneralMethod();
- return scriptConnect(fun->qobject(), index, receiver, function, fun->object());
+ return scriptConnect(fun->qobject(), index, receiver, function, fun->object(), type);
}
bool QScriptEnginePrivate::scriptDisconnect(const QScriptValueImpl &signal,
diff --git a/src/script/qscriptenginefwd_p.h b/src/script/qscriptenginefwd_p.h
index 11cd839..62942a5 100644
--- a/src/script/qscriptenginefwd_p.h
+++ b/src/script/qscriptenginefwd_p.h
@@ -385,7 +385,8 @@ public:
bool scriptConnect(QObject *sender, const char *signal,
const QScriptValueImpl &receiver,
- const QScriptValueImpl &function);
+ const QScriptValueImpl &function,
+ Qt::ConnectionType type);
bool scriptDisconnect(QObject *sender, const char *signal,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function);
@@ -393,14 +394,16 @@ public:
bool scriptConnect(QObject *sender, int index,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function,
- const QScriptValueImpl &senderWrapper = QScriptValueImpl());
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type);
bool scriptDisconnect(QObject *sender, int index,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function);
bool scriptConnect(const QScriptValueImpl &signal,
const QScriptValueImpl &receiver,
- const QScriptValueImpl &function);
+ const QScriptValueImpl &function,
+ Qt::ConnectionType type);
bool scriptDisconnect(const QScriptValueImpl &signal,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function);
diff --git a/src/script/qscriptextqobject.cpp b/src/script/qscriptextqobject.cpp
index 00963a7..a3cb4e6 100644
--- a/src/script/qscriptextqobject.cpp
+++ b/src/script/qscriptextqobject.cpp
@@ -1420,7 +1420,8 @@ public:
bool addSignalHandler(QObject *sender, int signalIndex,
const QScriptValueImpl &receiver,
const QScriptValueImpl &slot,
- const QScriptValueImpl &senderWrapper = QScriptValueImpl());
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type);
bool removeSignalHandler(
QObject *sender, int signalIndex,
const QScriptValueImpl &receiver,
@@ -1741,13 +1742,14 @@ void QScript::QObjectConnectionManager::mark(int generation)
bool QScript::QObjectConnectionManager::addSignalHandler(
QObject *sender, int signalIndex, const QScriptValueImpl &receiver,
- const QScriptValueImpl &function, const QScriptValueImpl &senderWrapper)
+ const QScriptValueImpl &function, const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type)
{
if (connections.size() <= signalIndex)
connections.resize(signalIndex+1);
QVector<QObjectConnection> &cs = connections[signalIndex];
int absSlotIndex = m_slotCounter + metaObject()->methodOffset();
- bool ok = QMetaObject::connect(sender, signalIndex, this, absSlotIndex);
+ bool ok = QMetaObject::connect(sender, signalIndex, this, absSlotIndex, type);
if (ok) {
cs.append(QScript::QObjectConnection(m_slotCounter++, receiver, function, senderWrapper));
QMetaMethod signal = sender->metaObject()->method(signalIndex);
@@ -2176,12 +2178,13 @@ bool QScriptQObjectData::addSignalHandler(QObject *sender,
int signalIndex,
const QScriptValueImpl &receiver,
const QScriptValueImpl &slot,
- const QScriptValueImpl &senderWrapper)
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type)
{
if (!m_connectionManager)
m_connectionManager = new QScript::QObjectConnectionManager();
return m_connectionManager->addSignalHandler(
- sender, signalIndex, receiver, slot, senderWrapper);
+ sender, signalIndex, receiver, slot, senderWrapper, type);
}
bool QScriptQObjectData::removeSignalHandler(QObject *sender,
diff --git a/src/script/qscriptextqobject_p.h b/src/script/qscriptextqobject_p.h
index 764644f..8f10823 100644
--- a/src/script/qscriptextqobject_p.h
+++ b/src/script/qscriptextqobject_p.h
@@ -216,7 +216,8 @@ public:
int signalIndex,
const QScriptValueImpl &receiver,
const QScriptValueImpl &slot,
- const QScriptValueImpl &senderWrapper = QScriptValueImpl());
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type);
bool removeSignalHandler(QObject *sender,
int signalIndex,
const QScriptValueImpl &receiver,