QML 接口到 QWebChannel . 更多...
import 语句: | import QtWebChannel 1.0 |
Since: | Qt 5.4 |
WebChannel 提供机制去透明访问 QObject 或 QML 对象从 HTML 客户端。,所有特性、信号及公共槽都可以被使用,从 HTML 客户端。
另请参阅 QWebChannel and JavaScript API .
远程客户端应该可以访问的对象列表。
对象必须拥有附加 id property set to an identifier, under which the object is then known on the HTML side.
Once registered, all signals and property changes are automatically propagated to the clients. Public invokable methods, including slots, are also accessible to the clients.
If one needs to register objects which are not available when the component is created, use the imperative registerObjects 方法。
另请参阅 registerObjects() and id .
A list of transport objects, which implement QWebChannelAbstractTransport . The transports are used to talk to the remote clients.
另请参阅 connectTo() and disconnectFrom() .
The identifier under which an object, registered to a WebChannel, is known to remote clients.
This property must be set for every object that should be published over the WebChannel. While no restrictions are enforced on the format of the id, it is usually a good idea to choose a string that is also a valid JavaScript identifier.
连接到 transport ,表示到单个客户端的通信通道。
The transport object must be an implementation of QWebChannelAbstractTransport .
另请参阅 transports and disconnectFrom() .
void disconnectFrom ( QWebChannelAbstractTransport transport ) |
断开连接 transport 从此 WebChannel。
The client will not be able to communicate with the WebChannel anymore, nor will it receive any signals or property updates.
另请参阅 connectTo() .
Registers objects to make them accessible to HTML clients. The key of the map is used as an identifier for the object on the client side.
Once registered, all signals and property changes are automatically propagated to the clients. Public invokable methods, including slots, are also accessible to the clients.
This imperative API can be used to register objects on the fly. For static objects, the declarative registeredObjects property should be preferred.
另请参阅 registeredObjects .