本页内容

QPropertyData Class

template <typename T> class QPropertyData

QPropertyData 类是用于具有自动属性绑定的属性的辅助类。更多内容...

头文件: #include <QPropertyData>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
自: Qt 6.0
继承自: QUntypedPropertyData
继承自:

QObjectBindableProperty 以及QProperty

公共函数

QPropertyData()
~QPropertyData()
void setValueBypassingBindings(QPropertyData<T>::parameter_type v)
void setValueBypassingBindings(QPropertyData<T>::rvalue_ref v)
QPropertyData<T>::parameter_type valueBypassingBindings() const

详细说明

QPropertyData 是一个模板类,其中模板参数T 指定了要存储的属性值的类型。

QPropertyData<T> 是可容纳具有自动数据绑定属性的类的通用基类。它主要封装了存储的数据,并提供对该数据的低级访问。

该类提供的对数据的低级访问会绕过绑定机制,因此应谨慎使用,因为对值的更新不会传播到依赖此属性的任何绑定中。

通常应调用QProperty<T> 或QObjectBindableProperty<T> 上的 value() 和 setValue() 方法,而不要使用本类提供的低级机制。

成员函数文档

[default] QPropertyData::QPropertyData()

默认——构造一个QPropertyData 的实例。

[default] QPropertyData::~QPropertyData()

销毁QPropertyData 的实例。

void QPropertyData::setValueBypassingBindings(QPropertyData<T>::parameter_type v)

将此属性中存储的数据值设置为v 。

注意:使用 此方法将绕过为此属性注册的任何潜在绑定。

另请参阅 valueBypassingBindings()。

void QPropertyData::setValueBypassingBindings(QPropertyData<T>::rvalue_ref v)

将此属性中存储的数据值设置为v 。

注意:使用 此方法将绕过为此属性注册的任何潜在绑定。

这是一个重载函数。

QPropertyData<T>::parameter_type QPropertyData::valueBypassingBindings() const

返回存储在此属性中的数据。

注意:由于 此操作会绕过任何绑定评估,因此 如果此属性上设置了绑定,它可能会返回过时的值。使用此方法也不会将该属性访问注册到任何当前正在执行的绑定中。

另请参阅 ` setValueBypassingBindings()`。

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