WebChannel QML Type
QML interface to QWebChannel. More...
Import Statement: | import QtWebChannel 1.14 |
Since: | Qt 5.4 |
Properties
- registeredObjects : QQmlListProperty<QObject>
- transports : QQmlListProperty<QObject>
Attached Properties
- id : QString
Methods
- void connectTo(transport)
- void disconnectFrom(transport)
- void registerObjects(objects)
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 QWebChannel and JavaScript API.
Property Documentation
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 registerObjects() and id.
A list of transport objects, which implement QWebChannelAbstractTransport. The transports are used to talk to the remote clients.
See also connectTo() and disconnectFrom().
Attached Property Documentation
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
Connects to the transport, which represents a communication channel to a single client.
The transport object must be an implementation of QWebChannelAbstractTransport.
See also transports and disconnectFrom().
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 connectTo().
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 registeredObjects.
© 2020 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.