このページでは

QWebChannelAbstractTransport Class

C++のQWebChannel サーバーとHTML/JSクライアント間の通信チャネル。詳細...

Header: #include <QWebChannelAbstractTransport>
qmake: QT += webchannel
Inherits: QObject

パブリック関数

QWebChannelAbstractTransport(QObject *parent = nullptr)
virtual ~QWebChannelAbstractTransport() override

パブリックスロット

virtual void sendMessage(const QJsonObject &message) = 0

シグナル

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

詳細な説明

QWebChannel のユーザーは、このインターフェースを実装し、QWebChannel に接続する必要があるすべてのクライアントについて、そのインスタンスをQWebChannel サーバーに接続する必要があります。Qt WebChannel スタンドアロンサンプルでは、これを実現する方法を示しています。 Qt WebSockets。

注: JSONメッセージプロトコルは 内部仕様と見なされており、将来変更される可能性があります。

「Qt WebChannel 」スタンドアロン・サンプルも参照してください 。

メンバ関数のドキュメント

[explicit] QWebChannelAbstractTransport::QWebChannelAbstractTransport(QObject *parent = nullptr)

指定されたparent を使用して、トランスポートオブジェクトを構築します。

[override virtual noexcept] QWebChannelAbstractTransport::~QWebChannelAbstractTransport()

輸送オブジェクトを破棄します。

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

リモートクライアントから新しいJSONmessage を受信した際には、このシグナルを発行する必要があります。transport 引数には、このトランスポートオブジェクトを設定する必要があります。

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

リモートクライアントにJSON形式のmessage を送信します。実装では、メッセージをシリアライズし、リモートのJavaScriptクライアントに送信します。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.