本页内容

QPropertyChangeHandler Class

template <typename Functor> class QPropertyChangeHandler

QPropertyChangeHandler 类负责控制安装在QProperty 上的变更回调的生命周期。更多内容...

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

详细描述

QPropertyChangeHandler 是一个模板类,其中模板参数Functor 指定了在属性值发生变化时被调用的回调函数的类型。

当通过 `QProperty::onValueChanged ` 和 `QProperty::subscribe` 在 `QProperty ` 上注册回调以监听属性值的变更时,会创建 `QPropertyChangeHandler<Functor>`。只要变更处理程序仍处于活动状态,回调就保持已安装状态。

可以通过移动语义在 C++ 作用域之间传递处理程序实例。

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