WebChannel QML Type▲
-
Import Statement: import QtWebChannel 1.4
-
Since:: Qt 5.4
-
Group: WebChannel is part of webchannel-qml
Detailed Description▲
The WebChannel provides a mechanism to transparently access QObject or QML objects from HTML clients. All properties, signals and public slots can be used from the HTML clients.
See Also▲
See also QWebChannel, JavaScript API
Property Documentation▲
[read-only] registeredObjects : QQmlListProperty<QObject>▲
A list of objects which should be accessible to remote clients.
The objects must have the attached 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 method.
See Also▲
See also registerObjects(), id
[read-only] transports : QQmlListProperty<QObject>▲
A list of transport objects, which implement QWebChannelAbstractTransport. The transports are used to talk to the remote clients.
See Also▲
See also connectTo(), disconnectFrom()
Attached Property Documentation▲
WebChannel.id : QString▲
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.
Method Documentation▲
void connectTo(QWebChannelAbstractTransport transport)▲
Connects to the transport, which represents a communication channel to a single client.
The transport object must be an implementation of QWebChannelAbstractTransport.
See Also▲
See also transports, disconnectFrom()
void disconnectFrom(QWebChannelAbstractTransport transport)▲
Disconnects the transport from this WebChannel.
The client will not be able to communicate with the WebChannel anymore, nor will it receive any signals or property updates.
See Also▲
See also connectTo()
void registerObjects(QVariantMap objects)▲
Registers the specified 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.
See Also▲
See also registeredObjects