PySide6.QtRemoteObjects.QRemoteObjectNode¶
- class QRemoteObjectNode¶
A node on a Qt Remote Objects network.
Details
The
QRemoteObjectNodeclass provides an entry point to a QtRemoteObjects network. A network can be as simple as two nodes, or an arbitrarily complex set of processes and devices.A
QRemoteObjectNodedoes not have a url that other nodes can connect to, and thus is able to acquire replicas only. It is not able to share source objects (onlyQRemoteObjectHostandQRemoteObjectRegistryHostNodes can share).Nodes may connect to each other directly using
connectToNode, or they can use theQRemoteObjectRegistryto simplify connections.The
QRemoteObjectRegistryis a special replica available to every node that connects to the Registry Url. It knows how to connect to every QRemoteObjectSource object on the network.Inherited by:
QRemoteObjectHostBase,QRemoteObjectRegistryHost,QRemoteObjectHostSynopsis¶
Properties¶
heartbeatIntervalᅟ- Heartbeat interval in mspersistedStoreᅟ- Allows setting a QRemoteObjectAbstractPersistedStore instance for the noderegistryUrlᅟ- Address of the Registry used by this node
Methods¶
def
__init__()def
acquire()def
acquireDynamic()def
acquireModel()def
connectToNode()def
instances()def
lastError()def
persistedStore()def
registry()def
registryUrl()
Virtual methods¶
def
setName()def
setRegistryUrl()
Signals¶
def
error()
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
- class ErrorCode¶
This enum type specifies the various error codes associated with
QRemoteObjectNodeerrors:Constant
Description
QRemoteObjectNode.ErrorCode.NoError
No error.
QRemoteObjectNode.ErrorCode.RegistryNotAcquired
The registry could not be acquired.
QRemoteObjectNode.ErrorCode.RegistryAlreadyHosted
The registry is already defined and hosting Sources.
QRemoteObjectNode.ErrorCode.NodeIsNoServer
The given
QRemoteObjectNodeis not a host node.QRemoteObjectNode.ErrorCode.ServerAlreadyCreated
The host node has already been initialized.
QRemoteObjectNode.ErrorCode.UnintendedRegistryHosting
An attempt was made to create a host
QRemoteObjectNodeand connect to itself as the registry.QRemoteObjectNode.ErrorCode.OperationNotValidOnClientNode
The attempted operation is not valid on a client
QRemoteObjectNode.QRemoteObjectNode.ErrorCode.SourceNotRegistered
The given QRemoteObjectSource is not registered on this node.
QRemoteObjectNode.ErrorCode.MissingObjectName
The given QObject does not have objectName() set.
QRemoteObjectNode.ErrorCode.HostUrlInvalid
The given url has an invalid or unrecognized scheme.
QRemoteObjectNode.ErrorCode.ProtocolMismatch
The client and the server have different protocol versions.
QRemoteObjectNode.ErrorCode.ListenFailed
Can’t listen on the specified host port.
QRemoteObjectNode.ErrorCode.SocketAccessError
The client isn’t allowed to connect to the server. Ensure that
setLocalServerOptionsis set appropriately.
Note
Properties can be used directly when
from __feature__ import true_propertyis used or via accessor functions otherwise.- property heartbeatIntervalᅟ: int¶
This property holds Heartbeat interval in ms..
The heartbeat (only helpful for socket connections) will periodically send a message to connected nodes to detect whether the connection was disrupted. Qt Remote Objects will try to reconnect automatically if it detects a dropped connection. This function can help with that detection since the client will only detect that the server is unavailable when it tries to send data.
A value of
0(the default) will disable the heartbeat.- Access functions:
- property persistedStoreᅟ: QRemoteObjectAbstractPersistedStore¶
This property holds Allows setting a
QRemoteObjectAbstractPersistedStoreinstance for the node..Allows replica PROP members with the PERSISTED trait to save their current value when the replica is deleted and restore a stored value the next time the replica is started.
Requires a
QRemoteObjectAbstractPersistedStoreclass implementation to control where and how persistence is handled.- Access functions:
This property holds The address of the
Registryused by this node..This is an empty QUrl if there is no registry in use.
- Access functions:
Default constructor for
QRemoteObjectNodewith the givenparent. A Node constructed in this manner can not be connected to, and thus can not expose Source objects on the network. It also will not include aQRemoteObjectRegistry, unless set manually usingsetRegistryUrl.See also
QRemoteObjectNodeconnected to a {QRemoteObjectRegistry} {Registry}. A Node constructed in this manner can not be connected to, and thus can not expose Source objects on the network. Finding and connecting to other (Host) Nodes is handled by theQRemoteObjectRegistryspecified byregistryAddress.- acquire(arg__1[, name=0])¶
- Parameters:
arg__1 –
PyTypeObjectname – object
- Return type:
PyTypeObject
- acquireDynamic(name)¶
- Parameters:
name – str
- Return type:
Returns a
QRemoteObjectDynamicReplicaof the Sourcename.- acquireModel(name[, action=QtRemoteObjects.FetchRootSize[, rolesHint={}]])¶
- Parameters:
name – str
action –
InitialActionrolesHint – .list of int
- Return type:
Returns a pointer to a Replica which is specifically derived from QAbstractItemModel. The
nameprovided must match the name used with the matchingenableRemotingthat put the Model on the network.actionspecifies whether the model should fetch data before theinitializedsignal is emitted. If it’s set toPrefetchData, then the data for roles in therolesHintwill be prefetched. IfrolesHintis empty, then the data for all the roles exposed by Source will be prefetched.The returned model will be empty until it is initialized with the Source .
In order to
acquire()Replica objects over External QIODevices , Qt Remote Objects needs access to the communications channel (a QIODevice) between the respective nodes. It is the addClientSideConnection() call that enables this, taking theioDeviceas input. Anyacquire()call made without calling addClientSideConnection will still work, but the Node will not be able to initialize the Replica without being provided the connection to the Host node.See also
Connects a client node to the host node at
address.Connections will remain valid until the host node is deleted or no longer accessible over a network.
Once a client is connected to a host, valid Replicas can then be acquired if the corresponding Source is being remoted.
Return
trueon success,falseotherwise (usually an unrecognized url, or connecting to already connected address).- heartbeatInterval()¶
- Return type:
int
See also
Getter of property
heartbeatIntervalᅟ.- heartbeatIntervalChanged(heartbeatInterval)¶
- Parameters:
heartbeatInterval – int
Notification signal of property
heartbeatIntervalᅟ.- instances(typeName)¶
- Parameters:
typeName – str
- Return type:
list of strings
This convenience function provides the same result as the templated version, but takes the name of the Source class as a parameter (
typeName) rather than deriving it from the class type.Returns the last error set.
- persistedStore()¶
- Return type:
See also
Getter of property
persistedStoreᅟ.- registry()¶
- Return type:
Returns a pointer to the Node’s
QRemoteObjectRegistry, if the Node is using the Registry feature; otherwise it returnsNone.- registryUrl()¶
- Return type:
See also
Getter of property
registryUrlᅟ.- remoteObjectAdded(loc)¶
- Parameters:
loc – .std.pairQString,QRemoteObjectSourceLocationInfo
This signal is emitted whenever a new Source object is added to the Registry. The signal will not be emitted if there is no Registry set (i.e., Sources over connections made via
connectToNodedirectly). Thelocparameter contains the information about the added Source, including name, type and the QUrl of the hosting Node.See also
- remoteObjectRemoved(loc)¶
- Parameters:
loc – .std.pairQString,QRemoteObjectSourceLocationInfo
This signal is emitted whenever a known Source object is removed from the Registry. The signal will not be emitted if there is no Registry set (i.e., Sources over connections made via
connectToNodedirectly). Thelocparameter contains the information about the removed Source, including name, type and the QUrl of the hosting Node.See also
- setHeartbeatInterval(interval)¶
- Parameters:
interval – int
See also
Setter of property
heartbeatIntervalᅟ.- setName(name)¶
- Parameters:
name – str
Sets
nameas the internal name for this Node. This is then output as part of the logging (if enabled). This is primarily useful if you merge log data from multiple nodes.- setPersistedStore(persistedStore)¶
- Parameters:
persistedStore –
QRemoteObjectAbstractPersistedStore
See also
Setter of property
persistedStoreᅟ.- waitForRegistry([timeout=30000])¶
- Parameters:
timeout – int
- Return type:
bool
Blocks until this Node’s Registry is initialized or
timeout(in milliseconds) expires. Returnstrueif the Registry is successfully initialized upon return, orfalseotherwise.