モデル・ビュー・クライアント
サーバー上のコンテンツや変更内容を表示する、非常にシンプルなクライアントプログラムの開発。
これは、モデル・ビュー・サーバーに付属するクライアントサイドアプリケーションです。
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();そして最後に、ごく基本的なアプリケーションでそのモデルを表示します。
© 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.