PySide6.QtRemoteObjects.QRemoteObjectReplica¶
- class QRemoteObjectReplica¶
A class interacting with (but not implementing) a Qt API on the Remote Object network. More…
Inherited by:
QRemoteObjectRegistry
,QRemoteObjectDynamicReplica
Synopsis¶
Properties¶
Methods¶
def
__init__()
def
initializeNode()
def
isInitialized()
def
isReplicaValid()
def
node()
def
propAsVariant()
def
send()
def
sendWithReply()
def
setChild()
def
state()
def
waitForSource()
Virtual methods¶
def
initialize()
def
setNode()
Signals¶
def
initialized()
def
notified()
def
stateChanged()
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¶
A Remote Object Replica is a QObject proxy for another QObject (called the Source object). Once initialized, a replica can be considered a “latent copy” of the Source object. That is, every change to a Q_PROPERTY on the Source , or signal emitted by the Source will be updated/emitted by all Replica objects. Latency is introduced by process scheduling by any OSes involved and network communication latency. As long as the replica has been initialized and the communication is not disrupted, receipt and order of changes is guaranteed.
The
isInitialized
andstate
properties (and correspondinginitialized()
/stateChanged()
signals) allow the state of a Replica to be determined.While Qt Remote Objects (QtRO) handles the initialization and synchronization of Replica objects, there are numerous steps happening behind the scenes which can fail and that aren’t encountered in single process Qt applications. See Troubleshooting for advice on how to handle such issues when using a remote objects network.
- class State¶
This enum type specifies the various state codes associated with
QRemoteObjectReplica
states:Constant
Description
QRemoteObjectReplica.Uninitialized
Initial value of DynamicReplica, where nothing is known about the replica before connection to source.
QRemoteObjectReplica.Default
Initial value of static replica, where any defaults set in the .rep file are available so it can be used if necessary.
QRemoteObjectReplica.Valid
Indicates the replica is connected, has good property values and can be interacted with.
QRemoteObjectReplica.Suspect
Error state that occurs if the connection to the source is lost after it is initialized.
QRemoteObjectReplica.SignatureMismatch
Error state that occurs if a connection to the source is made, but the source and replica are not derived from the same .rep (only possible for static Replicas).
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property nodeᅟ: QRemoteObjectNode¶
This property holds A pointer to the node this object was acquired from..
- property stateᅟ: QRemoteObjectReplica.State¶
This property holds Returns the replica state..
This property holds the replica
State
.- Access functions:
Signal
stateChanged()
- __init__()¶
- initialize()¶
- initializeNode(node[, name=""])¶
- Parameters:
node –
QRemoteObjectNode
name – str
- initialized()¶
This signal is emitted once the replica is initialized. An intialized replica has all property values set, but has not yet emitted any property change notifications.
See also
- isInitialized()¶
- Return type:
bool
Returns
true
if this replica has been initialized with data from the Source object. Returnsfalse
otherwise.See also
- isReplicaValid()¶
- Return type:
bool
Returns
true
if this replica has been initialized and has a valid connection with thenode
hosting the Source . Returnsfalse
otherwise.See also
- node()¶
- Return type:
See also
Getter of property
nodeᅟ
.- notified()¶
This signal is emitted once the replica is initialized and all property change notifications have been emitted.
It is sometimes useful to respond to property changes as events. For example, you might want to display a user notification when a certain property change occurs. However, this user notification would then also be triggered when a replica first became
QRemoteObjectReplica::Valid
, as all property change signals are emitted at that time. This isn’t always desirable, andnotified
allows the developer to distinguish between these two cases.- persistProperties(repName, repSig, props)¶
- Parameters:
repName – str
repSig –
QByteArray
props – .list of QVariant
- propAsVariant(i)¶
- Parameters:
i – int
- Return type:
object
- retrieveProperties(repName, repSig)¶
- Parameters:
repName – str
repSig –
QByteArray
- Return type:
.list of QVariant
- sendWithReply(call, index, args)¶
- Parameters:
call –
Call
index – int
args – .list of QVariant
- Return type:
- setChild(i, arg__2)¶
- Parameters:
i – int
arg__2 – object
- setNode(node)¶
- Parameters:
node –
QRemoteObjectNode
See also
Setter of property
nodeᅟ
.Returns the current
state
of the replica.See also
Getter of property
stateᅟ
.This signal is emitted whenever a replica’s state toggles between
State
.The change in state is represented with
state
andoldState
.See also
Notification signal of property
stateᅟ
.- waitForSource([timeout=30000])¶
- Parameters:
timeout – int
- Return type:
bool
Blocking call that waits for the replica to become initialized or until the
timeout
(in ms) expires. Returnstrue
if the replica is initialized when the call completes,false
otherwise.If
timeout
is -1, this function will not time out.See also