QScopedPropertyUpdateGroup Class
围绕 `Qt::beginPropertyUpdateGroup()` 和 `Qt::endPropertyUpdateGroup()` 实现的 RAII 类。更多内容...
| 头文件: | #include <QScopedPropertyUpdateGroup> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
| 自: | Qt 6.6 |
公共函数
详细描述
该类在其构造函数中调用Qt::beginPropertyUpdateGroup(),并在其析构函数中调用Qt::endPropertyUpdateGroup(),从而确保即使出现提前返回或抛出异常的情况,后者也能被可靠地调用。
注意: Qt::endPropertyUpdateGroup() 可能会重新抛出由绑定评估引发的异常。这意味着,如果在栈展开过程中,另一个异常导致 QScopedPropertyUpdateGroup 的析构函数被调用,您的应用程序可能会崩溃(此时会调用std::terminate() )。如果您预计绑定评估会引发异常,请使用手动调用的Qt::endPropertyUpdateGroup() 以及try/catch 代码块。
另请参阅 QProperty 。
成员函数文档
QScopedPropertyUpdateGroup::QScopedPropertyUpdateGroup()
调用Qt::beginPropertyUpdateGroup()。
QScopedPropertyUpdateGroup::~QScopedPropertyUpdateGroup()
© 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.