diff options
Diffstat (limited to 'src/webchannel')
-rw-r--r-- | src/webchannel/qwebchannel.cpp | 6 | ||||
-rw-r--r-- | src/webchannel/qwebchannel.h | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/webchannel/qwebchannel.cpp b/src/webchannel/qwebchannel.cpp index f7a2c5f..70c8f35 100644 --- a/src/webchannel/qwebchannel.cpp +++ b/src/webchannel/qwebchannel.cpp @@ -123,6 +123,12 @@ void QWebChannel::registerObject(const QString &id, QObject *object) d->publisher->registerObject(id, object); } +void QWebChannel::deregisterObject(QObject *object) +{ + // handling of deregistration is analogously to handling of a destroyed signal + d->publisher->signalEmitted(object, s_destroyedSignalIndex, QVariantList() << QVariant::fromValue(object)); +} + bool QWebChannel::blockUpdates() const { return d->publisher->blockUpdates; diff --git a/src/webchannel/qwebchannel.h b/src/webchannel/qwebchannel.h index 22d87a7..4f464b3 100644 --- a/src/webchannel/qwebchannel.h +++ b/src/webchannel/qwebchannel.h @@ -77,7 +77,8 @@ public: * TODO: This must be called, before clients are initialized. */ void registerObjects(const QHash<QString, QObject*> &objects); - void registerObject(const QString &id, QObject *object); + Q_INVOKABLE void registerObject(const QString &id, QObject *object); + Q_INVOKABLE void deregisterObject(QObject *object); /** * @return true when property updates are blocked, false otherwise. |