Qt Remote Objects QML Types
다음에 대한 QML 유형은 Qt Remote Objects 는 원격 객체 네트워크를 구축하는 데 필요한 보조 구성 요소를 제공합니다. 이들은 일반적으로 특정 네트워크를 구성하는 사용자 정의 등록 복제 유형과 함께 사용됩니다.
예를 들어, 다음 .rep 파일을 살펴보겠습니다:
class MyType {
PROP(QString myProp="Hello World")
};생성된 리플리카는 QML 타입으로 등록할 수 있습니다:
qmlRegisterType<MyTypeReplica>("custom",1,0,"MyTypeReplica")그런 다음 QML에서 기본 유형인 Node와 함께 사용할 수 있습니다:
import QtQuick
import QtRemoteObjects
import custom 1.0
Item {
MyTypeReplica {
id: myType
node: Node { registryUrl: "local:registry" }
}
Text { text: myType.myProp }
MouseArea {
anchors.fill: parent
onClicked: myType.pushMyProp("Updated Text")
}
}기본적으로 레플리카 속성에 직접 값을 할당할 수 없으며, 대신 ` push ` 함수를 사용해야 합니다. 이는 선언적 프로그래밍과 비동기 업데이트가 혼합될 때 발생할 수 있는 잠재적 문제 때문입니다. 구체적으로, 다음과 같은 문제를 방지하기 위함입니다:
myType.myProp = "Updated Text"
console.log(myType.myProp) // logs "Hello World", as the new text has not yet been round-tripped이 모듈의 QML 타입은 .qml 파일에서 다음 import 문을 사용하여 애플리케이션으로 가져올 수 있습니다:
import QtRemoteObjectsQML 유형
Qt Remote Objects 네트워크상의 호스트 노드 | |
Qt Remote Objects 네트워크상의 노드 | |
Global 객체는 QML에서 원격 타입을 다루는 데 유용한 기능을 제공합니다 | |
지속화된 속성을 위한 기본 저장소 |
© 2026 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.