모델 뷰 클라이언트
서버의 콘텐츠와 변경 사항을 표시하는 매우 간단한 클라이언트 프로그램을 개발합니다.
이것이 Model-View 서버와 함께 제공되는 클라이언트 측 애플리케이션입니다.
QRemoteObjectNode node(QUrl(QStringLiteral("local:registry"))); node.setHeartbeatInterval(1000);
먼저 QRemoteObjectNode 을 만들고 로컬 컴퓨터에 있는 레지스트리에 연결합니다. 또한 heartbeat interval 을 설정합니다. 하트비트는 소스에 대한 연결이 중단되었는지 감지하는 데 유용합니다. 이 경우 모든 트래픽이 로컬이므로 서버가 종료된 시점을 감지할 수 있습니다.
QScopedPointer<QAbstractItemModelReplica> model(node.acquireModel(QStringLiteral("RemoteModel")));
그런 다음 모든 데이터가 포함된 모델을 acquire. 이 경우 연결된 원격 개체 네트워크에서 RemoteModel
이라는 모델을 가져옵니다.
QTreeView view; view.setWindowTitle(QStringLiteral("RemoteView")); view.resize(640,480); view.setModel(model.data()); view.show();
마지막으로 아주 기본적인 애플리케이션에 모델을 표시합니다.
© 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.