与远程对象网络 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 源 object). Once initialized, a replica can be considered a "latent copy" of the 源 object. That is, every change to a Q_PROPERTY 在 源 , or signal emitted by the 源 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.
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). |
This property holds a pointer to the node this object was acquired from.
访问函数:
QRemoteObjectNode * | node () const |
void | setNode (QRemoteObjectNode * node ) |
Returns the replica state.
This property holds the replica 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 ().
返回
true
若此复本已初始化采用数据来自
源
对象。返回
false
否则。
另请参阅 state ().
返回
true
if this replica has been initialized and has a valid connection with the
node
hosting the
源
。返回
false
否则。
另请参阅 isInitialized ().
返回
true
若此复本已初始化采用数据来自
源
对象。返回
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 ().
Blocking call that waits for the replica to become initialized or until the
timeout
(in ms) expires. Returns
true
if the replica is initialized when the call completes,
false
否则。
若 timeout 是 -1,此函数不会超时。
另请参阅 isInitialized () 和 initialized ().