QPropertyData Class

template <typename T> class QPropertyData

QPropertyData 类是带有自动属性绑定的属性的辅助类。更多

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

QObjectBindablePropertyQProperty

公共函数

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

详细说明

QPropertyData<T> 是一个通用基类,用于保存具有自动数据绑定的属性。它主要封装存储的数据,并提供对这些数据的低级访问。

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

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

成员函数文档

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()。

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