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 .