PySide6.QtRemoteObjects.QRemoteObjectNode¶
- class QRemoteObjectNode¶
- A node on a Qt Remote Objects network. More… - Inherited by: - QRemoteObjectHostBase,- QRemoteObjectRegistryHost,- QRemoteObjectHost- Synopsis¶- Properties¶- heartbeatIntervalᅟ- Heartbeat interval in ms
- persistedStoreᅟ- Allows setting a QRemoteObjectAbstractPersistedStore instance for the node
- registryUrlᅟ- Address of the Registry used by this node
 - Methods¶- def - __init__()
- 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 - Detailed Description¶- 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 (only- QRemoteObjectHostand- QRemoteObjectRegistryHostNodes can share).- Nodes may connect to each other directly using - connectToNode, or they can use the- QRemoteObjectRegistryto 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.- class ErrorCode¶
- This enum type specifies the various error codes associated with - QRemoteObjectNodeerrors:- Constant - Description - QRemoteObjectNode.NoError - No error. - QRemoteObjectNode.RegistryNotAcquired - The registry could not be acquired. - QRemoteObjectNode.RegistryAlreadyHosted - The registry is already defined and hosting Sources. - QRemoteObjectNode.NodeIsNoServer - The given - QRemoteObjectNodeis not a host node.- QRemoteObjectNode.ServerAlreadyCreated - The host node has already been initialized. - QRemoteObjectNode.UnintendedRegistryHosting - An attempt was made to create a host - QRemoteObjectNodeand connect to itself as the registry.- QRemoteObjectNode.OperationNotValidOnClientNode - The attempted operation is not valid on a client - QRemoteObjectNode.- QRemoteObjectNode.SourceNotRegistered - The given QRemoteObjectSource is not registered on this node. - QRemoteObjectNode.MissingObjectName - The given QObject does not have objectName() set. - QRemoteObjectNode.HostUrlInvalid - The given url has an invalid or unrecognized scheme. - QRemoteObjectNode.ProtocolMismatch - The client and the server have different protocol versions. - QRemoteObjectNode.ListenFailed - Can’t listen on the specified host port. - QRemoteObjectNode.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 given- parent. 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 a- QRemoteObjectRegistry, unless set manually using- setRegistryUrl.- 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 the- QRemoteObjectRegistryspecified by- registryAddress.- acquireDynamic(name)¶
- Parameters:
- name – str 
- Return type:
 
 - Returns a - QRemoteObjectDynamicReplicaof the Source- name.- acquireModel(name[, action=QtRemoteObjects.FetchRootSize[, rolesHint={}]])¶
- Parameters:
- name – str 
- action – - InitialAction
- rolesHint – .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 matching- enableRemotingthat put the Model on the network.- actionspecifies whether the model should fetch data before the- initializedsignal is emitted. If it’s set to- PrefetchData, then the data for roles in the- rolesHintwill be prefetched. If- rolesHintis 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 the- ioDeviceas input. Any- acquire()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 function overloads - instances().- 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 returns- None.- 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). The- locparameter 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). The- locparameter 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. Returns- trueif the Registry is successfully initialized upon return, or- falseotherwise.