QML 接口到 QWebChannel . 更多...
| import 語句: |
import QtWebChannel 1.8
|
WebChannel 提供機製去透明訪問 QObject 或 QML 對象從 HTML 客戶端。,所有特性、信號及公共槽都可以被使用,從 HTML 客戶端。
另請參閱 QWebChannel and JavaScript API .
|
blockUpdates : bool |
當設為
true
, updates are blocked and remote clients will not be notified about property changes.
The changes are recorded and sent to the clients once updates become unblocked again by setting this property to
false
. By default, updates are not blocked.
|
propertyUpdateInterval : int |
The property update interval.
This interval can be changed to a different interval in milliseconds by setting it to a positive value. Property updates are batched and sent out after the interval expires. If set to zero, the updates occurring within a single event loop run are batched and sent out on the next run. If negative, updates will be sent immediately. Default value is 50 milliseconds.
遠程客戶端應該可以訪問的對象列錶。
對象必須擁有附加 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 () 和 id .
A list of transport objects, which implement QWebChannelAbstractTransport . The transports are used to talk to the remote clients.
另請參閱 connectTo () 和 disconnectFrom ().
|
WebChannel.id : string |
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.
|
void connectTo ( QtObject transport ) |
連接到 transport ,錶示到單個客戶端的通信通道。
The transport object must be an implementation of QWebChannelAbstractTransport .
另請參閱 transports and disconnectFrom ().
|
void deregisterObject ( QtObject object ) |
撤銷注冊給定 object from the WebChannel.
遠程客戶端會接收
destroyed
信號對於給定對象。
另請參閱 registerObjects (), registerObject (),和 registeredObjects .
|
void disconnectFrom ( QtObject 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 a single object to the WebChannel.
The properties, signals and public methods of the object are published to the remote clients. There, an object with the identifier id 然後被構造。
A property that is
BINDABLE
but does not have a
NOTIFY
signal will have working property updates on the client side, but no mechanism to register a callback for the change notifications.
注意: 當前的限製是對象被注冊,在任何客戶端被初始化之前。
另請參閱 registerObjects (), deregisterObject (),和 registeredObjects .
|
void registerObjects ( object 對象 ) |
注冊指定 objects to make them accessible to HTML clients. objects should be a JavaScript Map object. 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 .