QWebChannelAbstractTransport Class

Communication channel between the C++ QWebChannel server and a HTML/JS client. 更多...

头文件: #include <QWebChannelAbstractTransport>
qmake: QT += webchannel
开始支持版本: Qt 5.4
基类: QObject

公有函数

QWebChannelAbstractTransport(QObject *parent = Q_NULLPTR)
virtual ~QWebChannelAbstractTransport()
  • 32 个公有函数继承自 QObject

公有槽函数

virtual void sendMessage(const QJsonObject &message) = 0
  • 1 个公有槽函数继承自 QObject

信号

void messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport)

其他继承的成员

  • 1 个属性继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 9 个受保护的函数继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

Communication channel between the C++ QWebChannel server and a HTML/JS client.

Users of the QWebChannel must implement this interface and connect instances of it to the QWebChannel server for every client that should be connected to the QWebChannel. The Qt WebChannel Standalone Example shows how this can be done using Qt WebSockets.

Note: The JSON message protocol is considered internal and might change over time.

参见 Qt WebChannel Standalone Example.

成员函数

QWebChannelAbstractTransport::QWebChannelAbstractTransport(QObject *parent = Q_NULLPTR)

Constructs a transport object with the given parent.

[virtual] QWebChannelAbstractTransport::~QWebChannelAbstractTransport()

Destroys the transport object.

[signal] void QWebChannelAbstractTransport::messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport)

This signal must be emitted when a new JSON message was received from the remote client. The transport argument should be set to this transport object.

[pure virtual slot] void QWebChannelAbstractTransport::sendMessage(const QJsonObject &message)

Sends a JSON message to the remote client. An implementation would serialize the message and transmit it to the remote JavaScript client.