QWebChannel¶
Exposes QObjects to remote HTML clients. More…

Synopsis¶
Functions¶
def
blockUpdates()def
deregisterObject(object)def
registerObject(id, object)def
registerObjects(objects)def
registeredObjects()def
setBlockUpdates(block)
Slots¶
def
connectTo(transport)def
disconnectFrom(transport)
Signals¶
def
blockUpdatesChanged(block)
Detailed Description¶
The
QWebChannelfills the gap between C++ applications and HTML/JavaScript applications. By publishing aQObjectderived object to aQWebChanneland using the qwebchannel.js on the HTML side, one can transparently access properties and public slots and methods of theQObject. No manual message passing and serialization of data is required, property updates and signal emission on the C++ side get automatically transmitted to the potentially remotely running HTML clients. On the client side, a JavaScript object will be created for any published C++QObject. It mirrors the C++ object’s API and thus is intuitively useable.The C++
QWebChannelAPI makes it possible to talk to any HTML client, which could run on a local or even remote machine. The only limitation is that the HTML client supports the JavaScript features used byqwebchannel.js. As such, one can interact with basically any modern HTML browser or standalone JavaScript runtime, such as node.js.There also exists a declarative WebChannel API .
See also
Qt WebChannel Standalone Example JavaScript API
-
class
QWebChannel([parent=Q_NULLPTR])¶ - param parent
QObject
Constructs the
QWebChannelobject with the givenparent.Note that a
QWebChannelis only fully operational once you connect it to aQWebChannelAbstractTransport. The HTML clients also need to be setup appropriately usingqwebchannel.js:ref:` <Qt-WebChannel-JavaScript-API>` .
-
PySide2.QtWebChannel.QWebChannel.blockUpdates()¶ - Return type
bool
See also
-
PySide2.QtWebChannel.QWebChannel.blockUpdatesChanged(block)¶ - Parameters
block –
bool
-
PySide2.QtWebChannel.QWebChannel.connectTo(transport)¶ - Parameters
transport –
QWebChannelAbstractTransport
Connects the
QWebChannelto the giventransportobject.The transport object then handles the communication between the C++ application and a remote HTML client.
-
PySide2.QtWebChannel.QWebChannel.deregisterObject(object)¶ - Parameters
object –
QObject
Deregisters the given
objectfrom theQWebChannel.Remote clients will receive a
destroyedsignal for the given object.
-
PySide2.QtWebChannel.QWebChannel.disconnectFrom(transport)¶ - Parameters
transport –
QWebChannelAbstractTransport
Disconnects the
QWebChannelfrom thetransportobject.See also
-
PySide2.QtWebChannel.QWebChannel.registerObject(id, object)¶ - Parameters
id – unicode
object –
QObject
Registers a single object to the
QWebChannel.The properties, signals and public methods of the
objectare published to the remote clients. There, an object with the identifieridis then constructed.Note
A current limitation is that objects must be registered before any client is initialized.
-
PySide2.QtWebChannel.QWebChannel.registerObjects(objects)¶ - Parameters
objects –
Registers a group of objects to the
QWebChannel.The properties, signals and public invokable methods of the objects are published to the remote clients. There, an object with the identifier used as key in the
objectsmap is then constructed.Note
A current limitation is that objects must be registered before any client is initialized.
-
PySide2.QtWebChannel.QWebChannel.registeredObjects()¶ - Return type
Returns the map of registered objects that are published to remote clients.
-
PySide2.QtWebChannel.QWebChannel.setBlockUpdates(block)¶ - Parameters
block –
bool
See also
© 2018 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.