QWebChannelAbstractTransport Class
Canale di comunicazione tra il server C++ QWebChannel e un client HTML/JS. Per saperne di più...
| Header: | #include <QWebChannelAbstractTransport> |
| qmake: | QT += webchannel |
| Inherits: | QObject |
Funzioni pubbliche
| QWebChannelAbstractTransport(QObject *parent = nullptr) | |
| virtual | ~QWebChannelAbstractTransport() override |
Slot pubblici
| virtual void | sendMessage(const QJsonObject &message) = 0 |
Segnali
| void | messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport) |
Descrizione dettagliata
Gli utenti dell'QWebChannel devono implementare questa interfaccia e collegarne le istanze al server QWebChannel per ogni client che deve essere connesso a QWebChannel. L'esempio autonomoQt WebChannel mostra come farlo utilizzando Qt WebSockets.
Nota: il protocollo dei messaggi JSON è considerato interno e potrebbe subire modifiche nel tempo.
Vedi anche l’esempio “Qt WebChannel ” in modalità standalone.
Documentazione sulle funzioni membro
[explicit] QWebChannelAbstractTransport::QWebChannelAbstractTransport(QObject *parent = nullptr)
Crea un oggetto di trasporto con l'parent e specificato.
[override virtual noexcept] QWebChannelAbstractTransport::~QWebChannelAbstractTransport()
Elimina l'oggetto di trasporto.
[signal] void QWebChannelAbstractTransport::messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport)
Questo segnale deve essere emesso quando viene ricevuto un nuovo oggetto JSON message dal client remoto. L'argomento transport deve essere impostato su questo oggetto di trasporto.
[pure virtual slot] void QWebChannelAbstractTransport::sendMessage(const QJsonObject &message)
Invia un messaggio JSON message al client remoto. Un'implementazione serializzerebbe il messaggio e lo trasmetterebbe al client JavaScript remoto.
© 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.