本页内容

QtROClientFactory Class

一个类,用于存储Qt Remote Objects 网络上可用的客户端后端的相关信息。更多内容...

头文件: #include <QtROClientFactory>
CMake: find_package(Qt6 REQUIRED COMPONENTS RemoteObjects)
target_link_libraries(mytarget PRIVATE Qt6::RemoteObjects)
qmake: QT += remoteobjects
void qRegisterRemoteObjectsClient(const QString &id)

详细说明

相关非会员

template <typename T> void qRegisterRemoteObjectsClient(const QString &id)

为类型T 注册远程对象客户端id 。

如果需要为Qt Remote Objects 定义自定义传输协议,则需在此处注册客户端和服务器实现。

注意:此 函数要求在调用该函数时,T 必须是一个已完全定义的类型。

此示例将类CustomClientIo 注册为"myprotocol" :

qRegisterRemoteObjectsClient<CustomClientIo>(QStringLiteral("myprotocol"));

完成此操作后,您现在可以使用此新的自定义协议来实例化节点:

QRemoteObjectNode client(QUrl(QStringLiteral("myprotocol:registry")));

另请参阅 qRegisterRemoteObjectsServer 。

© 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.