Qt Remote Objects QML Types
에 대한 QML 유형은 Qt Remote Objects 에 대한 QML 유형은 원격 개체 네트워크를 구축하는 데 필요한 도우미 조각을 제공합니다. 일반적으로 특정 네트워크를 구성하는 사용자 지정 등록 복제본 유형과 함께 사용됩니다.
예를 들어 다음 .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 QtRemoteObjects
QML 유형
Qt Remote Objects 네트워크의 호스트 노드 | |
Qt Remote Objects 네트워크의 노드 | |
글로벌 객체는 QML에서 원격 유형 작업에 유용한 기능을 제공합니다. | |
영구 프로퍼티를 위한 기본 저장소 |
© 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.