本页内容

QRemoteObjectDynamicReplica Class

一个动态实例化的Replica。更多内容...

标题: #include <QRemoteObjectDynamicReplica>
CMake: find_package(Qt6 REQUIRED COMPONENTS RemoteObjects)
target_link_libraries(mytarget PRIVATE Qt6::RemoteObjects)
qmake: QT += remoteobjects
继承自: QRemoteObjectReplica

公共函数

virtual ~QRemoteObjectDynamicReplica() override

详细描述

复本分为生成型复本(即由复本编译器生成的、包含头文件的复本)和动态复本(即在运行时动态生成的复本)。本类即为动态复本类型。

当与源对象建立连接时,初始化步骤会传递当前的属性值(参见“副本初始化”)。在 DynamicReplica 中,属性/信号/插槽的详细信息也会一并发送,从而允许在运行时动态创建副本对象。 这在 QML 或脚本中可能很方便,但有两个主要缺点。首先,在由源对象成功初始化之前,该对象实际上是“空的”。其次,在 C++ 中,必须使用 `QMetaObject::invokeMethod()` 进行调用,因为生成的 moc 查找将不可用。

该类没有公共构造函数。只能通过动态的QRemoteObjectNode::acquire 方法进行实例化。

成员函数文档

[override virtual noexcept] QRemoteObjectDynamicReplica::~QRemoteObjectDynamicReplica()

销毁动态副本。

另请参阅 “副本所有权”。

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