QRemoteObjectReplica Class

원격 객체 네트워크에서 Qt API와 상호 작용하는(구현하지는 않지만) 클래스입니다. 더 보기...

헤더: #include <QRemoteObjectReplica>
CMake: find_package(Qt6 REQUIRED COMPONENTS RemoteObjects)
target_link_libraries(mytarget PRIVATE Qt6::RemoteObjects)
qmake: QT += remoteobjects
상속합니다: QObject
상속 대상

QRemoteObjectDynamicReplicaQRemoteObjectRegistry

공용 유형

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

속성

  • node : QRemoteObjectNode*
  • state : const State

공공 기능

bool isInitialized() const
bool isReplicaValid() const
QRemoteObjectNode *node() const
virtual void setNode(QRemoteObjectNode *node)
QRemoteObjectReplica::State state() const
bool waitForSource(int timeout = 30000)

신호

void initialized()
void notified()
void stateChanged(QRemoteObjectReplica::State state, QRemoteObjectReplica::State oldState)

상세 설명

원격 객체 복제본은 다른 QObject ( 소스 객체라고 함)에 대한 QObject 프록시입니다. 일단 초기화되면 복제본은 소스 오브젝트의 "잠복 복사본"으로 간주할 수 있습니다. 즉, 소스의 Q_PROPERTY 에 대한 모든 변경 사항 또는 소스에서 방출되는 신호가 모든 리플리케이션 오브젝트에 의해 업데이트/발송됩니다. 지연 시간은 관련된 모든 OS의 프로세스 스케줄링과 네트워크 통신 지연 시간에 의해 발생합니다. 복제본이 초기화되고 통신이 중단되지 않는 한 변경사항의 수신 및 순서는 보장됩니다.

isInitializedstate 속성(및 해당 initialized()/stateChanged() 신호)을 통해 복제본의 상태를 확인할 수 있습니다.

Qt Remote Objects (QtRO)는 복제 객체의 초기화 및 동기화를 처리하지만, 단일 프로세스 Qt 애플리케이션에서는 발생하지 않는 수많은 단계가 백그라운드에서 발생하며 실패할 수 있습니다. 원격 객체 네트워크를 사용할 때 이러한 문제를 처리하는 방법에 대한 조언은 문제 해결을 참조하십시오.

멤버 유형 문서

enum QRemoteObjectReplica::State

이 열거형 유형은 QRemoteObjectReplica 상태와 관련된 다양한 상태 코드를 지정합니다:

상수설명
QRemoteObjectReplica::Uninitialized0소스 연결 전에는 복제본에 대해 아무것도 알 수 없는 DynamicReplica의 초기값입니다.
QRemoteObjectReplica::Default1정적 복제본의 초기 값으로, .rep 파일에 설정된 모든 기본값을 사용할 수 있으므로 필요한 경우 사용할 수 있습니다.
QRemoteObjectReplica::Valid2복제본이 연결되어 있고 속성 값이 양호하며 상호 작용할 수 있는 상태임을 나타냅니다.
QRemoteObjectReplica::Suspect3소스 초기화 후 소스에 대한 연결이 끊어진 경우 발생하는 오류 상태입니다.
QRemoteObjectReplica::SignatureMismatch4소스에 연결되었지만 소스와 리플리카가 동일한 .rep에서 파생되지 않은 경우 발생하는 오류 상태입니다(정적 리플리카에만 가능).

속성 문서

node : QRemoteObjectNode*

이 프로퍼티는 이 객체를 획득한 노드에 대한 포인터를 보유합니다.

함수에 액세스합니다:

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

[read-only] state : const State

레플리카 상태를 반환합니다.

이 프로퍼티는 복제본 QRemoteObjectReplica::State 을 보유합니다.

액세스 함수:

QRemoteObjectReplica::State state() const

알림 신호:

void stateChanged(QRemoteObjectReplica::State state, QRemoteObjectReplica::State oldState)

멤버 함수 문서

[signal] void QRemoteObjectReplica::initialized()

이 신호는 복제본이 초기화되면 발신됩니다. 초기화된 복제본은 모든 속성 값이 설정되어 있지만 아직 속성 변경 알림을 보내지 않았습니다.

isInitialized() 및 stateChanged()도 참조하세요 .

bool QRemoteObjectReplica::isInitialized() const

이 복제본이 소스 오브젝트의 데이터로 초기화된 경우 true 을 반환합니다. 그렇지 않으면 false 을 반환합니다.

state()도 참조하세요 .

bool QRemoteObjectReplica::isReplicaValid() const

이 복제본이 초기화되었고 소스를 호스팅하는 node 과 유효한 연결이 있는 경우 true 을 반환합니다. 그렇지 않으면 false 을 반환합니다.

isInitialized()도 참조하세요 .

[signal] void QRemoteObjectReplica::notified()

이 신호는 복제본이 초기화되고 모든 속성 변경 알림이 전송되면 전송됩니다.

때로는 속성 변경을 이벤트로 응답하는 것이 유용할 수 있습니다. 예를 들어 특정 속성 변경이 발생하면 사용자 알림을 표시하고 싶을 수 있습니다. 그러나 이 사용자 알림은 복제본이 처음 QRemoteObjectReplica::Valid 이 되었을 때 트리거되며, 이때 모든 속성 변경 신호가 전송되기 때문입니다. 이는 항상 바람직한 것은 아니며 notified 을 사용하면 개발자가 이 두 가지 경우를 구분할 수 있습니다.

QRemoteObjectReplica::State QRemoteObjectReplica::state() const

복제본의 현재 state 를 반환합니다.

참고: 속성 상태에 대한 게터 함수입니다.

isInitialized도 참조하세요 .

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

이 신호는 복제본의 상태가 QRemoteObjectReplica::State 사이를 전환할 때마다 전송됩니다.

상태의 변화는 stateoldState 로 표시됩니다.

참고: 속성 state 에 대한 알림 신호입니다.

state() 및 initialized()도 참조하세요 .

bool QRemoteObjectReplica::waitForSource(int timeout = 30000)

복제본이 초기화될 때까지 또는 timeout (ms 단위)가 만료될 때까지 기다리는 호출을 차단합니다. 호출이 완료될 때 복제본이 초기화되면 true, 그렇지 않으면 false 을 반환합니다.

timeout 이 -1이면 이 함수는 시간 초과되지 않습니다.

isInitialized() 및 initialized()도 참조하세요 .

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.