本页内容

QRemoteObjectAbstractPersistedStore Class

一个类,用于提供将副本的 PROP 值设置为该副本上次使用时所具有的值的方法。更多内容...

头文件: #include <QRemoteObjectAbstractPersistedStore>
CMake: find_package(Qt6 REQUIRED COMPONENTS RemoteObjects)
target_link_libraries(mytarget PRIVATE Qt6::RemoteObjects)
qmake: QT += remoteobjects
继承自: QObject

公共函数

QRemoteObjectAbstractPersistedStore(QObject *parent = nullptr)
virtual QVariantList restoreProperties(const QString &repName, const QByteArray &repSig) = 0
virtual void saveProperties(const QString &repName, const QByteArray &repSig, const QVariantList &values) = 0

详细说明

这可用于提供一个“合理”的值,在与源建立连接并获取当前值之前,该值将显示出来。

必须重写此类,以提供保存(QRemoteObjectAbstractPersistedStore::saveProperties )和恢复(QRemoteObjectAbstractPersistedStore::restoreProperties )PROP值的实现。随后可将派生类型设置为某个节点,此时从该节点获取的任何副本在调用副本析构函数时都会自动存储 PERSISTED 属性,并在实例化副本时检索这些值。

成员函数文档

QRemoteObjectAbstractPersistedStore::QRemoteObjectAbstractPersistedStore(QObject *parent = nullptr)

使用给定的parent 构建一个QRemoteObjectAbstractPersistedStore。parent 的默认值为nullptr 。

[pure virtual] QVariantList QRemoteObjectAbstractPersistedStore::restoreProperties(const QString &repName, const QByteArray &repSig)

在初始化副本时,该方法将收到副本类的repName 和repSig 。继承类有责任获取由QRemoteObjectAbstractPersistedStore::saveProperties 持久化的最新值并返回这些值。如果没有可用值,则应返回一个空的QVariantList 。

另请参阅 QRemoteObjectAbstractPersistedStore::saveProperties 。

[pure virtual] void QRemoteObjectAbstractPersistedStore::saveProperties(const QString &repName, const QByteArray &repSig, const QVariantList &values)

该方法将接收复制类在调用复制析构函数时,其repName 、repSig 以及values 列表中包含的PERSISTED属性。继承类有责任以一种便于QRemoteObjectAbstractPersistedStore::restoreProperties 检索的方式存储这些信息。

另请参阅 QRemoteObjectAbstractPersistedStore::restoreProperties 。

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