diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/webchannel/plugin.cpp | 5 | ||||
-rw-r--r-- | src/imports/webchannel/webchannel.pro | 8 | ||||
-rw-r--r-- | src/webchannel/qmetaobjectpublisher.cpp | 2 | ||||
-rw-r--r-- | src/webchannel/qmetaobjectpublisher_p.h | 2 | ||||
-rw-r--r-- | src/webchannel/qqmlwebchannel.cpp (renamed from src/imports/webchannel/qmlwebchannel.cpp) | 128 | ||||
-rw-r--r-- | src/webchannel/qqmlwebchannel.h (renamed from src/imports/webchannel/qmlwebchannel.h) | 39 | ||||
-rw-r--r-- | src/webchannel/qqmlwebchannelattached.cpp (renamed from src/imports/webchannel/qmlwebchannelattached.cpp) | 10 | ||||
-rw-r--r-- | src/webchannel/qqmlwebchannelattached_p.h (renamed from src/imports/webchannel/qmlwebchannelattached.h) | 14 | ||||
-rw-r--r-- | src/webchannel/qwebchannel.cpp | 32 | ||||
-rw-r--r-- | src/webchannel/qwebchannel.h | 14 | ||||
-rw-r--r-- | src/webchannel/qwebchannel_p.h | 7 | ||||
-rw-r--r-- | src/webchannel/webchannel.pro | 12 |
12 files changed, 158 insertions, 115 deletions
diff --git a/src/imports/webchannel/plugin.cpp b/src/imports/webchannel/plugin.cpp index 6507112..235f542 100644 --- a/src/imports/webchannel/plugin.cpp +++ b/src/imports/webchannel/plugin.cpp @@ -42,7 +42,8 @@ #include <qqml.h> #include <QtQml/QQmlExtensionPlugin> -#include "qmlwebchannel.h" +#include <qqmlwebchannel.h> +#include <qqmlwebchannelattached_p.h> QT_BEGIN_NAMESPACE @@ -59,7 +60,7 @@ void QWebChannelPlugin::registerTypes(const char *uri) { int major = 1; int minor = 0; - qmlRegisterType<QmlWebChannel>(uri, major, minor, "WebChannel"); + qmlRegisterType<QQmlWebChannel>(uri, major, minor, "WebChannel"); } QT_END_NAMESPACE diff --git a/src/imports/webchannel/webchannel.pro b/src/imports/webchannel/webchannel.pro index c1959f5..8ae6ef5 100644 --- a/src/imports/webchannel/webchannel.pro +++ b/src/imports/webchannel/webchannel.pro @@ -4,12 +4,6 @@ INCLUDEPATH += ../../webchannel VPATH += ../../webchannel SOURCES += \ - plugin.cpp \ - qmlwebchannel.cpp \ - qmlwebchannelattached.cpp - -HEADERS += \ - qmlwebchannel.h \ - qmlwebchannelattached.h + plugin.cpp load(qml_plugin) diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp index 096bf7b..646398d 100644 --- a/src/webchannel/qmetaobjectpublisher.cpp +++ b/src/webchannel/qmetaobjectpublisher.cpp @@ -395,7 +395,7 @@ QByteArray QMetaObjectPublisher::invokeMethod(QObject *const object, const int m void QMetaObjectPublisher::signalEmitted(const QObject *object, const int signalIndex, const QVariantList &arguments) { - if (!webChannel || webChannel->d->transports.isEmpty()) { + if (!webChannel || webChannel->d_func()->transports.isEmpty()) { return; } if (!signalToPropertyMap.value(object).contains(signalIndex)) { diff --git a/src/webchannel/qmetaobjectpublisher_p.h b/src/webchannel/qmetaobjectpublisher_p.h index dda18ae..4da0c26 100644 --- a/src/webchannel/qmetaobjectpublisher_p.h +++ b/src/webchannel/qmetaobjectpublisher_p.h @@ -172,7 +172,7 @@ protected: void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; private: - friend class QmlWebChannel; + friend class QQmlWebChannelPrivate; friend class QWebChannel; friend class TestWebChannel; diff --git a/src/imports/webchannel/qmlwebchannel.cpp b/src/webchannel/qqmlwebchannel.cpp index e61e9c8..ca99fe5 100644 --- a/src/imports/webchannel/qmlwebchannel.cpp +++ b/src/webchannel/qqmlwebchannel.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlwebchannel.h" +#include "qqmlwebchannel.h" #include "qwebchannel_p.h" #include "qmetaobjectpublisher_p.h" @@ -47,20 +47,50 @@ #include <QtQml/QQmlContext> -QT_USE_NAMESPACE +#include "qqmlwebchannelattached_p.h" -QmlWebChannel::QmlWebChannel(QObject *parent) - : QWebChannel(parent) +QT_BEGIN_NAMESPACE + +class QQmlWebChannelPrivate : public QWebChannelPrivate +{ + Q_DECLARE_PUBLIC(QQmlWebChannel) +public: + QVector<QObject*> registeredObjects; + + void _q_objectIdChanged(const QString &newId); +}; + +void QQmlWebChannelPrivate::_q_objectIdChanged(const QString &newId) +{ + Q_Q(QQmlWebChannel); + const QQmlWebChannelAttached *const attached = qobject_cast<QQmlWebChannelAttached*>(q->sender()); + Q_ASSERT(attached); + Q_ASSERT(attached->parent()); + Q_ASSERT(registeredObjects.contains(attached->parent())); + + QObject *const object = attached->parent(); + const QString &oldId = publisher->registeredObjectIds.value(object); + + if (!oldId.isEmpty()) { + q->deregisterObject(object); + } + + q->registerObject(newId, object); +} + +QQmlWebChannel::QQmlWebChannel(QObject *parent) + : QWebChannel(*(new QQmlWebChannelPrivate), parent) { } -QmlWebChannel::~QmlWebChannel() +QQmlWebChannel::~QQmlWebChannel() { } -void QmlWebChannel::registerObjects(const QVariantMap &objects) +void QQmlWebChannel::registerObjects(const QVariantMap &objects) { + Q_D(QQmlWebChannel); QMap<QString, QVariant>::const_iterator it = objects.constBegin(); for (; it != objects.constEnd(); ++it) { QObject *object = it.value().value<QObject*>(); @@ -72,34 +102,12 @@ void QmlWebChannel::registerObjects(const QVariantMap &objects) } } -bool QmlWebChannel::test_clientIsIdle() const +QQmlWebChannelAttached *QQmlWebChannel::qmlAttachedProperties(QObject *obj) { - return d->publisher->clientIsIdle; + return new QQmlWebChannelAttached(obj); } -void QmlWebChannel::objectIdChanged(const QString &newId) -{ - const QmlWebChannelAttached *const attached = qobject_cast<QmlWebChannelAttached*>(sender()); - Q_ASSERT(attached); - Q_ASSERT(attached->parent()); - Q_ASSERT(m_registeredObjects.contains(attached->parent())); - - QObject *const object = attached->parent(); - const QString &oldId = d->publisher->registeredObjectIds.value(object); - - if (!oldId.isEmpty()) { - deregisterObject(object); - } - - registerObject(newId, object); -} - -QmlWebChannelAttached *QmlWebChannel::qmlAttachedProperties(QObject *obj) -{ - return new QmlWebChannelAttached(obj); -} - -void QmlWebChannel::connectTo(QObject *transport) +void QQmlWebChannel::connectTo(QObject *transport) { if (QWebChannelAbstractTransport *realTransport = qobject_cast<QWebChannelAbstractTransport*>(transport)) { QWebChannel::connectTo(realTransport); @@ -108,7 +116,7 @@ void QmlWebChannel::connectTo(QObject *transport) } } -void QmlWebChannel::disconnectFrom(QObject *transport) +void QQmlWebChannel::disconnectFrom(QObject *transport) { if (QWebChannelAbstractTransport *realTransport = qobject_cast<QWebChannelAbstractTransport*>(transport)) { QWebChannel::disconnectFrom(realTransport); @@ -117,7 +125,7 @@ void QmlWebChannel::disconnectFrom(QObject *transport) } } -QQmlListProperty<QObject> QmlWebChannel::registeredObjects() +QQmlListProperty<QObject> QQmlWebChannel::registeredObjects() { return QQmlListProperty<QObject>(this, 0, registeredObjects_append, @@ -126,44 +134,44 @@ QQmlListProperty<QObject> QmlWebChannel::registeredObjects() registeredObjects_clear); } -void QmlWebChannel::registeredObjects_append(QQmlListProperty<QObject> *prop, QObject *object) +void QQmlWebChannel::registeredObjects_append(QQmlListProperty<QObject> *prop, QObject *object) { - const QmlWebChannelAttached *const attached = qobject_cast<QmlWebChannelAttached*>( - qmlAttachedPropertiesObject<QmlWebChannel>(object, false /* don't create */)); + const QQmlWebChannelAttached *const attached = qobject_cast<QQmlWebChannelAttached*>( + qmlAttachedPropertiesObject<QQmlWebChannel>(object, false /* don't create */)); if (!attached) { const QQmlContext *const context = qmlContext(object); qWarning() << "Cannot register object" << context->nameForObject(object) << '(' << object << ") without attached WebChannel.id property. Did you forget to set it?"; return; } - QmlWebChannel *channel = static_cast<QmlWebChannel*>(prop->object); + QQmlWebChannel *channel = static_cast<QQmlWebChannel*>(prop->object); if (!attached->id().isEmpty()) { // TODO: warning in such cases? channel->registerObject(attached->id(), object); } - channel->m_registeredObjects.append(object); - connect(attached, SIGNAL(idChanged(QString)), channel, SLOT(objectIdChanged(QString))); + channel->d_func()->registeredObjects.append(object); + connect(attached, SIGNAL(idChanged(QString)), channel, SLOT(_q_objectIdChanged(QString))); } -int QmlWebChannel::registeredObjects_count(QQmlListProperty<QObject> *prop) +int QQmlWebChannel::registeredObjects_count(QQmlListProperty<QObject> *prop) { - return static_cast<QmlWebChannel*>(prop->object)->m_registeredObjects.size(); + return static_cast<QQmlWebChannel*>(prop->object)->d_func()->registeredObjects.size(); } -QObject *QmlWebChannel::registeredObjects_at(QQmlListProperty<QObject> *prop, int index) +QObject *QQmlWebChannel::registeredObjects_at(QQmlListProperty<QObject> *prop, int index) { - return static_cast<QmlWebChannel*>(prop->object)->m_registeredObjects.at(index); + return static_cast<QQmlWebChannel*>(prop->object)->d_func()->registeredObjects.at(index); } -void QmlWebChannel::registeredObjects_clear(QQmlListProperty<QObject> *prop) +void QQmlWebChannel::registeredObjects_clear(QQmlListProperty<QObject> *prop) { - QmlWebChannel *channel = static_cast<QmlWebChannel*>(prop->object); - foreach (QObject *object, channel->m_registeredObjects) { + QQmlWebChannel *channel = static_cast<QQmlWebChannel*>(prop->object); + foreach (QObject *object, channel->d_func()->registeredObjects) { channel->deregisterObject(object); } - return channel->m_registeredObjects.clear(); + return channel->d_func()->registeredObjects.clear(); } -QQmlListProperty<QObject> QmlWebChannel::transports() +QQmlListProperty<QObject> QQmlWebChannel::transports() { return QQmlListProperty<QObject>(this, 0, transports_append, @@ -172,28 +180,32 @@ QQmlListProperty<QObject> QmlWebChannel::transports() transports_clear); } -void QmlWebChannel::transports_append(QQmlListProperty<QObject> *prop, QObject *transport) +void QQmlWebChannel::transports_append(QQmlListProperty<QObject> *prop, QObject *transport) { - QmlWebChannel *channel = static_cast<QmlWebChannel*>(prop->object); + QQmlWebChannel *channel = static_cast<QQmlWebChannel*>(prop->object); channel->connectTo(transport); } -int QmlWebChannel::transports_count(QQmlListProperty<QObject> *prop) +int QQmlWebChannel::transports_count(QQmlListProperty<QObject> *prop) { - return static_cast<QmlWebChannel*>(prop->object)->d->transports.size(); + return static_cast<QQmlWebChannel*>(prop->object)->d_func()->transports.size(); } -QObject *QmlWebChannel::transports_at(QQmlListProperty<QObject> *prop, int index) +QObject *QQmlWebChannel::transports_at(QQmlListProperty<QObject> *prop, int index) { - QmlWebChannel *channel = static_cast<QmlWebChannel*>(prop->object); - return dynamic_cast<QObject*>(channel->d->transports.at(index)); + QQmlWebChannel *channel = static_cast<QQmlWebChannel*>(prop->object); + return channel->d_func()->transports.at(index); } -void QmlWebChannel::transports_clear(QQmlListProperty<QObject> *prop) +void QQmlWebChannel::transports_clear(QQmlListProperty<QObject> *prop) { QWebChannel *channel = static_cast<QWebChannel*>(prop->object); - foreach (QWebChannelAbstractTransport *transport, channel->d->transports) { + foreach (QWebChannelAbstractTransport *transport, channel->d_func()->transports) { channel->disconnectFrom(transport); } - Q_ASSERT(channel->d->transports.isEmpty()); + Q_ASSERT(channel->d_func()->transports.isEmpty()); } + +QT_END_NAMESPACE + +#include "moc_qqmlwebchannel.cpp" diff --git a/src/imports/webchannel/qmlwebchannel.h b/src/webchannel/qqmlwebchannel.h index 6bc7127..3bbd2a0 100644 --- a/src/imports/webchannel/qmlwebchannel.h +++ b/src/webchannel/qqmlwebchannel.h @@ -39,48 +39,45 @@ ** ****************************************************************************/ -#ifndef QMLWEBCHANNEL_H -#define QMLWEBCHANNEL_H +#ifndef QQMLWEBCHANNEL_H +#define QQMLWEBCHANNEL_H -#include <qwebchannel.h> - -#include "qmlwebchannelattached.h" - -#include <QVector> +#include <QtWebChannel/QWebChannel> +#include <QtWebChannel/qwebchannelglobal.h> #include <QtQml/qqml.h> #include <QtQml/QQmlListProperty> QT_BEGIN_NAMESPACE -class QmlWebChannel : public QWebChannel +class QQmlWebChannelPrivate; +class QQmlWebChannelAttached; +class Q_WEBCHANNEL_EXPORT QQmlWebChannel : public QWebChannel { Q_OBJECT + Q_DISABLE_COPY(QQmlWebChannel) Q_PROPERTY( QQmlListProperty<QObject> transports READ transports ); Q_PROPERTY( QQmlListProperty<QObject> registeredObjects READ registeredObjects ) public: - explicit QmlWebChannel(QObject *parent = 0); - virtual ~QmlWebChannel(); + explicit QQmlWebChannel(QObject *parent = 0); + virtual ~QQmlWebChannel(); Q_INVOKABLE void registerObjects(const QVariantMap &objects); QQmlListProperty<QObject> registeredObjects(); QQmlListProperty<QObject> transports(); - // TODO: remove this by replacing QML with C++ tests - Q_INVOKABLE bool test_clientIsIdle() const; - - static QmlWebChannelAttached *qmlAttachedProperties(QObject *obj); + static QQmlWebChannelAttached *qmlAttachedProperties(QObject *obj); Q_INVOKABLE void connectTo(QObject *transport); Q_INVOKABLE void disconnectFrom(QObject *transport); -private Q_SLOTS: - void objectIdChanged(const QString &newId); - private: + Q_DECLARE_PRIVATE(QQmlWebChannel) + Q_PRIVATE_SLOT(d_func(), void _q_objectIdChanged(const QString &newId)); + static void registeredObjects_append(QQmlListProperty<QObject> *prop, QObject *item); static int registeredObjects_count(QQmlListProperty<QObject> *prop); static QObject *registeredObjects_at(QQmlListProperty<QObject> *prop, int index); @@ -90,13 +87,11 @@ private: static int transports_count(QQmlListProperty<QObject> *prop); static QObject *transports_at(QQmlListProperty<QObject> *prop, int index); static void transports_clear(QQmlListProperty<QObject> *prop); - - QVector<QObject*> m_registeredObjects; }; -QML_DECLARE_TYPE( QmlWebChannel ) -QML_DECLARE_TYPEINFO( QmlWebChannel, QML_HAS_ATTACHED_PROPERTIES ) +QML_DECLARE_TYPE( QQmlWebChannel ) +QML_DECLARE_TYPEINFO( QQmlWebChannel, QML_HAS_ATTACHED_PROPERTIES ) QT_END_NAMESPACE -#endif // QMLWEBCHANNEL_H +#endif // QQMLWEBCHANNEL_H diff --git a/src/imports/webchannel/qmlwebchannelattached.cpp b/src/webchannel/qqmlwebchannelattached.cpp index 637feb2..cfe03f8 100644 --- a/src/imports/webchannel/qmlwebchannelattached.cpp +++ b/src/webchannel/qqmlwebchannelattached.cpp @@ -39,27 +39,27 @@ ** ****************************************************************************/ -#include "qmlwebchannelattached.h" +#include "qqmlwebchannelattached_p.h" QT_USE_NAMESPACE -QmlWebChannelAttached::QmlWebChannelAttached(QObject *parent) +QQmlWebChannelAttached::QQmlWebChannelAttached(QObject *parent) : QObject(parent) { } -QmlWebChannelAttached::~QmlWebChannelAttached() +QQmlWebChannelAttached::~QQmlWebChannelAttached() { } -QString QmlWebChannelAttached::id() const +QString QQmlWebChannelAttached::id() const { return m_id; } -void QmlWebChannelAttached::setId(const QString &id) +void QQmlWebChannelAttached::setId(const QString &id) { if (id != m_id) { m_id = id; diff --git a/src/imports/webchannel/qmlwebchannelattached.h b/src/webchannel/qqmlwebchannelattached_p.h index 3d60122..09d18d3 100644 --- a/src/imports/webchannel/qmlwebchannelattached.h +++ b/src/webchannel/qqmlwebchannelattached_p.h @@ -39,21 +39,23 @@ ** ****************************************************************************/ -#ifndef QMLWEBCHANNELATTACHED_H -#define QMLWEBCHANNELATTACHED_H +#ifndef QQMLWEBCHANNELATTACHED_H +#define QQMLWEBCHANNELATTACHED_H #include <QObject> +#include "qwebchannelglobal.h" + QT_BEGIN_NAMESPACE -class QmlWebChannelAttached : public QObject +class Q_WEBCHANNEL_EXPORT QQmlWebChannelAttached : public QObject { Q_OBJECT Q_PROPERTY( QString id READ id WRITE setId NOTIFY idChanged FINAL ) public: - explicit QmlWebChannelAttached(QObject *parent = 0); - virtual ~QmlWebChannelAttached(); + explicit QQmlWebChannelAttached(QObject *parent = 0); + virtual ~QQmlWebChannelAttached(); QString id() const; void setId(const QString &id); @@ -67,4 +69,4 @@ private: QT_END_NAMESPACE -#endif // QMLWEBCHANNELATTACHED_H +#endif // QQMLWEBCHANNELATTACHED_H diff --git a/src/webchannel/qwebchannel.cpp b/src/webchannel/qwebchannel.cpp index 651de58..d0b968e 100644 --- a/src/webchannel/qwebchannel.cpp +++ b/src/webchannel/qwebchannel.cpp @@ -72,13 +72,26 @@ void QWebChannelPrivate::_q_transportDestroyed(QObject *object) } } +void QWebChannelPrivate::init() +{ + Q_Q(QWebChannel); + publisher = new QMetaObjectPublisher(q); + QObject::connect(publisher, SIGNAL(blockUpdatesChanged(bool)), + q, SIGNAL(blockUpdatesChanged(bool))); +} + QWebChannel::QWebChannel(QObject *parent) -: QObject(parent) -, d(new QWebChannelPrivate) +: QObject(*(new QWebChannelPrivate), parent) +{ + Q_D(QWebChannel); + d->init(); +} + +QWebChannel::QWebChannel(QWebChannelPrivate &dd, QObject *parent) +: QObject(dd, parent) { - d->publisher = new QMetaObjectPublisher(this); - connect(d->publisher, SIGNAL(blockUpdatesChanged(bool)), - SIGNAL(blockUpdatesChanged(bool))); + Q_D(QWebChannel); + d->init(); } QWebChannel::~QWebChannel() @@ -87,6 +100,7 @@ QWebChannel::~QWebChannel() void QWebChannel::registerObjects(const QHash< QString, QObject * > &objects) { + Q_D(QWebChannel); const QHash<QString, QObject *>::const_iterator end = objects.constEnd(); for (QHash<QString, QObject *>::const_iterator it = objects.constBegin(); it != end; ++it) { d->publisher->registerObject(it.key(), it.value()); @@ -95,32 +109,38 @@ void QWebChannel::registerObjects(const QHash< QString, QObject * > &objects) QHash<QString, QObject *> QWebChannel::registeredObjects() const { + Q_D(const QWebChannel); return d->publisher->registeredObjects; } void QWebChannel::registerObject(const QString &id, QObject *object) { + Q_D(QWebChannel); d->publisher->registerObject(id, object); } void QWebChannel::deregisterObject(QObject *object) { + Q_D(QWebChannel); // 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 { + Q_D(const QWebChannel); return d->publisher->blockUpdates; } void QWebChannel::setBlockUpdates(bool block) { + Q_D(QWebChannel); d->publisher->setBlockUpdates(block); } void QWebChannel::connectTo(QWebChannelAbstractTransport *transport) { + Q_D(QWebChannel); Q_ASSERT(transport); if (!d->transports.contains(transport)) { d->transports << transport; @@ -134,6 +154,7 @@ void QWebChannel::connectTo(QWebChannelAbstractTransport *transport) void QWebChannel::disconnectFrom(QWebChannelAbstractTransport *transport) { + Q_D(QWebChannel); const int idx = d->transports.indexOf(transport); if (idx != -1) { disconnect(transport, 0, this, 0); @@ -143,6 +164,7 @@ void QWebChannel::disconnectFrom(QWebChannelAbstractTransport *transport) void QWebChannel::sendMessage(const QJsonValue &id, const QJsonValue &data) const { + Q_D(const QWebChannel); if (d->transports.isEmpty()) { qWarning("QWebChannel is not connected to any transports, cannot send messages."); return; diff --git a/src/webchannel/qwebchannel.h b/src/webchannel/qwebchannel.h index 3e6f7a1..a4f34b4 100644 --- a/src/webchannel/qwebchannel.h +++ b/src/webchannel/qwebchannel.h @@ -90,20 +90,22 @@ public: */ void setBlockUpdates(bool block); - void connectTo(QWebChannelAbstractTransport *transport); - void disconnectFrom(QWebChannelAbstractTransport *transport); - Q_SIGNALS: void blockUpdatesChanged(bool block); public Q_SLOTS: + void connectTo(QWebChannelAbstractTransport *transport); + void disconnectFrom(QWebChannelAbstractTransport *transport); + void sendMessage(const QJsonValue &id, const QJsonValue &data = QJsonValue()) const; private: - QScopedPointer<QWebChannelPrivate> d; - Q_PRIVATE_SLOT(d, void _q_transportDestroyed(QObject*)); + Q_DECLARE_PRIVATE(QWebChannel) + QWebChannel(QWebChannelPrivate &dd, QObject *parent = 0); + Q_PRIVATE_SLOT(d_func(), void _q_transportDestroyed(QObject*)); + friend class QMetaObjectPublisher; - friend class QmlWebChannel; + friend class QQmlWebChannel; friend class TestWebChannel; }; diff --git a/src/webchannel/qwebchannel_p.h b/src/webchannel/qwebchannel_p.h index fbdf2ef..62b2cd5 100644 --- a/src/webchannel/qwebchannel_p.h +++ b/src/webchannel/qwebchannel_p.h @@ -44,6 +44,7 @@ #include "qwebchannelglobal.h" +#include <private/qobject_p.h> #include <QVector> QT_BEGIN_NAMESPACE @@ -54,11 +55,15 @@ class QMetaObjectPublisher; Q_WEBCHANNEL_EXPORT QByteArray generateJSONMessage(const QJsonValue &id, const QJsonValue &data, bool response); -struct Q_WEBCHANNEL_EXPORT QWebChannelPrivate +class Q_WEBCHANNEL_EXPORT QWebChannelPrivate : public QObjectPrivate { + Q_DECLARE_PUBLIC(QWebChannel) +public: QVector<QWebChannelAbstractTransport*> transports; QMetaObjectPublisher *publisher; + void init(); + void _q_transportDestroyed(QObject* object); }; diff --git a/src/webchannel/webchannel.pro b/src/webchannel/webchannel.pro index 82bd79f..d368237 100644 --- a/src/webchannel/webchannel.pro +++ b/src/webchannel/webchannel.pro @@ -1,5 +1,5 @@ TARGET = QtWebChannel -QT = core +QT = core-private CONFIG += warn_on strict_flags load(qt_module) @@ -28,6 +28,16 @@ SOURCES += \ qtHaveModule(qml) { QT += qml DEFINES += HAVE_QML=1 + + SOURCES += \ + qqmlwebchannel.cpp \ + qqmlwebchannelattached.cpp + + PUBLIC_HEADERS += \ + qqmlwebchannel.h + + PRIVATE_HEADERS += \ + qqmlwebchannelattached_p.h } HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS |