QRemoteObjectAbstractPersistedStore Class
该类提供将副本的 PROP 值设置为上次使用副本时的值的方法。更多
Header: | #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 和 PERSISTED 属性的values 列表。继承类有责任以一致的方式存储信息,以便QRemoteObjectAbstractPersistedStore::restoreProperties 检索。
另请参阅 QRemoteObjectAbstractPersistedStore::restoreProperties 。
© 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.