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() called)。如果您预期绑定评估会产生异常,请使用手动Qt::endPropertyUpdateGroup() 调用和try/catch 块。

另请参阅 QProperty

成员函数文档

QScopedPropertyUpdateGroup::QScopedPropertyUpdateGroup()

调用Qt::beginPropertyUpdateGroup().

QScopedPropertyUpdateGroup::~QScopedPropertyUpdateGroup()

调用Qt::endPropertyUpdateGroup().

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