QRemoteObjectHostBase#
The QRemoteObjectHostBase
class provides base functionality common to Host
and RegistryHost
classes. More…
Inherited by: QRemoteObjectRegistryHost, QRemoteObjectHost
Synopsis#
Functions#
def
addHostSideConnection
(ioDevice)def
disableRemoting
(remoteObject)def
enableRemoting
(model, name, roles[, selectionModel=None])def
enableRemoting
(object[, name=””])def
proxy
(registryUrl[, hostUrl={}])def
reverseProxy
()
Virtual functions#
def
hostUrl
()def
setHostUrl
(hostAddress[, allowedSchemas=QRemoteObjectHostBase.AllowedSchemas.BuiltInSchemasOnly])
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
QRemoteObjectHostBase
is a base class that cannot be instantiated directly. It provides the enableRemoting
and disableRemoting
functionality shared by all host nodes ( Host
and RegistryHost
) as well as the logic required to expose Source objects on the Remote Objects network.
- class PySide6.QtRemoteObjects.QRemoteObjectHostBase#
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.AllowedSchemas#
This enum is used to specify whether a Node will accept a url with an unrecognized schema for the hostUrl. By default only urls with known schemas are accepted, but using AllowExternalRegistration
will enable the Registry to pass your external (to QtRO) url to client Nodes.
Constant
Description
QRemoteObjectHostBase.BuiltInSchemasOnly
Only allow the hostUrl to be set to a QtRO supported schema. This is the default value, and causes a Node error to be set if an unrecognized schema is provided.
QRemoteObjectHostBase.AllowExternalRegistration
The provided schema is registered as an External Schema
See also
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.addHostSideConnection(ioDevice)#
- Parameters:
ioDevice –
PySide6.QtCore.QIODevice
In order to enableRemoting()
Source objects over External QIODevices , Qt Remote Objects needs access to the communications channel (a QIODevice) between the respective nodes. It is the addHostSideConnection() call that enables this on the Source side, taking the ioDevice
as input. Any enableRemoting()
call will still work without calling addHostSideConnection, but the Node will not be able to share the Source objects without being provided the connection to the Replica node. Before calling this function you must call setHostUrl
() with a unique URL and AllowExternalRegistration
.
See also
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.disableRemoting(remoteObject)#
- Parameters:
remoteObject –
PySide6.QtCore.QObject
- Return type:
bool
Disables remote access for the QObject remoteObject
. Returns false
if the current node is a client node or if the remoteObject
is not registered, and returns true
if remoting is successfully disabled for the Source object.
Warning
Replicas of this object will no longer be valid after calling this method.
See also
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.enableRemoting(model, name, roles[, selectionModel=None])#
- Parameters:
name – str
roles – .list of int
selectionModel –
PySide6.QtCore.QItemSelectionModel
- Return type:
bool
This overload of enableRemoting()
is specific to QAbstractItemModel types (or any type derived from QAbstractItemModel). This is useful if you want to have a model and the HMI for the model in different processes.
The three required parameters are the model
itself, the name
by which to lookup the model, and the roles
that should be exposed on the Replica side. If you want to synchronize selection between Source and Replica , the optional selectionModel
parameter can be used. This is only recommended when using a single Replica.
Behind the scenes, Qt Remote Objects batches data() lookups and prefetches data when possible to make the model interaction as responsive as possible.
Returns false
if the current node is a client node, or if the QObject is already registered to be remoted, and true
if remoting is successfully enabled for the QAbstractItemModel.
See also
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.enableRemoting(object[, name=""])
- Parameters:
object –
PySide6.QtCore.QObject
name – str
- Return type:
bool
Enables a host node to dynamically provide remote access to the QObject object
. Client nodes connected to the node hosting this object may obtain Replicas of this Source.
The optional name
defines the lookup-name under which the QObject can be acquired using acquire()
. If not explicitly set then the name given in the QCLASSINFO_REMOTEOBJECT_TYPE will be used. If no such macro was defined for the QObject then the QObject::objectName() is used.
Returns false
if the current node is a client node, or if the QObject is already registered to be remoted, and true
if remoting is successfully enabled for the dynamic QObject.
See also
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.hostUrl()#
- Return type:
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.proxy(registryUrl[, hostUrl={}])#
- Parameters:
registryUrl –
PySide6.QtCore.QUrl
hostUrl –
PySide6.QtCore.QUrl
- Return type:
bool
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.reverseProxy()#
- Return type:
bool
- PySide6.QtRemoteObjects.QRemoteObjectHostBase.setHostUrl(hostAddress[, allowedSchemas=QRemoteObjectHostBase.AllowedSchemas.BuiltInSchemasOnly])#
- Parameters:
hostAddress –
PySide6.QtCore.QUrl
allowedSchemas –
AllowedSchemas
- Return type:
bool