QWebChannelAbstractTransport Class
Canal de comunicação entre o servidor C++ QWebChannel e um cliente HTML/JS. Mais...
| Header: | #include <QWebChannelAbstractTransport> |
| qmake: | QT += webchannel |
| Inherits: | QObject |
Funções públicas
| QWebChannelAbstractTransport(QObject *parent = nullptr) | |
| virtual | ~QWebChannelAbstractTransport() override |
Slots públicos
| virtual void | sendMessage(const QJsonObject &message) = 0 |
Sinais
| void | messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport) |
Descrição detalhada
Os usuários do ` QWebChannel ` devem implementar essa interface e conectar instâncias dela ao servidor ` QWebChannel ` para cada cliente que deva ser conectado ao ` QWebChannel`. O exemplo autônomo `Qt WebChannel ` mostra como isso pode ser feito usando Qt WebSockets.
Observação: o protocolo de mensagens JSON é considerado interno e pode sofrer alterações com o tempo.
Veja também o Exemplo autônomo doQt WebChannel .
Documentação das funções-membro
[explicit] QWebChannelAbstractTransport::QWebChannelAbstractTransport(QObject *parent = nullptr)
Cria um objeto de transporte com o ` parent` fornecido.
[override virtual noexcept] QWebChannelAbstractTransport::~QWebChannelAbstractTransport()
Destrói o objeto de transporte.
[signal] void QWebChannelAbstractTransport::messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport)
Este sinal deve ser emitido quando um novo JSON message for recebido do cliente remoto. O argumento transport deve ser definido como este objeto de transporte.
[pure virtual slot] void QWebChannelAbstractTransport::sendMessage(const QJsonObject &message)
Envia um ` message ` no formato JSON para o cliente remoto. Uma implementação seria serializar a mensagem e transmiti-la ao cliente 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.