QRemoteObjectReplica 類

與遠程對象網絡 Qt API 交互 (但未實現) 的類 更多...

頭: #include <QRemoteObjectReplica>
qmake: QT += remoteobjects
繼承: QObject
繼承者: QRemoteObjectDynamicReplica and QRemoteObjectRegistry

公共類型

enum State { Uninitialized, Default, Valid, Suspect, SignatureMismatch }

特性

公共函數

bool isInitialized () const
bool isReplicaValid () const
QRemoteObjectNode * node () const
void setNode (QRemoteObjectNode * node )
狀態 state () const
bool waitForSource (int timeout = 30000)

信號

void initialized ()
void stateChanged (State state , State oldState )

額外繼承成員

詳細描述

與遠程對象網絡 Qt API 交互 (但未實現) 的類

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 Source , or signal emitted by the Source will be updated/emitted by all 復本 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 and state properties (and corresponding initialized ()/ stateChanged () signals) allow the state of a 復本 to be determined.

While Qt Remote Objects (QtRO) handles the initialization and synchronization of 復本 objects, there are numerous steps happening behind the scenes which can fail and that aren't encountered in single process Qt applications. See 故障排除 for advice on how to handle such issues when using a remote objects network.

成員類型文檔編製

enum QRemoteObjectReplica:: State

This enum type specifies the various state codes associated with QRemoteObjectReplica states:

常量 描述
QRemoteObjectReplica::Uninitialized 0 initial value of DynamicReplica, where nothing is known about the replica before connection to source.
QRemoteObjectReplica::Default 1 initial value of static replica, where any defaults set in the .rep file are available so it can be used if necessary.
QRemoteObjectReplica::Valid 2 indicates the replica is connected, has good property values and can be interacted with.
QRemoteObjectReplica::Suspect 3 error state that occurs if the connection to the source is lost after it is initialized.
QRemoteObjectReplica::SignatureMismatch 4 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).

特性文檔編製

node : QRemoteObjectNode *

This property holds a pointer to the node this object was acquired from.

訪問函數:

QRemoteObjectNode * node () const
void setNode (QRemoteObjectNode * node )

state : const State

返迴復本狀態。

此特性保持復本的 QRemoteObjectReplica::State .

訪問函數:

狀態 state () const

通知程序信號:

void stateChanged (State state , State oldState )

成員函數文檔編製

[signal] void QRemoteObjectReplica:: initialized ()

This signal is emitted once the replica is initialized.

另請參閱 isInitialized () 和 stateChanged ().

bool QRemoteObjectReplica:: isInitialized () const

返迴 true 若此復本已初始化采用數據來自 Source 對象。返迴 false 否則。

另請參閱 state ().

bool QRemoteObjectReplica:: isReplicaValid () const

返迴 true if this replica has been initialized and has a valid connection with the node hosting the Source 。返迴 false 否則。

另請參閱 isInitialized ().

State QRemoteObjectReplica:: state () const

返迴 true 若此復本已初始化采用數據來自 Source 對象。返迴 false 否則。

注意: getter 函數對於特性 state .

另請參閱 isInitialized ().

[signal] void QRemoteObjectReplica:: stateChanged ( State state , State oldState )

This signal is emitted whenever a replica's state toggles between QRemoteObjectReplica::State .

The change in state is represented with state and oldState .

注意: 通知程序信號對於特性 state .

另請參閱 state () 和 initialized ().

bool QRemoteObjectReplica:: waitForSource ( int timeout = 30000)

Blocking call that waits for the replica to become initialized or until the timeout (in ms) expires. Returns true 若復本已初始化,當調用完成時, false 否則。

timeout 是 -1,此函數不會超時。

另請參閱 isInitialized () 和 initialized ().