本页内容

QPropertyBindingError Class

标题: #include <QPropertyBindingError>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
自: Qt 6.0

公共类型

enum Type { NoError, BindingLoop, EvaluationError, UnknownError }

公共函数

QPropertyBindingError()
QPropertyBindingError(QPropertyBindingError::Type type, const QString &description = QString())
QPropertyBindingError(const QPropertyBindingError &other)
QPropertyBindingError(QPropertyBindingError &&other)
~QPropertyBindingError()
QString description() const
QPropertyBindingError::Type type() const
QPropertyBindingError &operator=(QPropertyBindingError &&other)
QPropertyBindingError &operator=(const QPropertyBindingError &other)

详细说明

QPropertyBindingError 由属性系统用于报告在评估绑定时发生的错误。使用type() 查询发生了哪种错误,并使用description() 提取可能包含更多详细信息的错误消息。如果没有错误,QPropertyBindingError 的类型为QPropertyBindingError::NoError ,且hasError() 返回 false。

externQProperty<int>prop;

QPropertyBindingError error=prop.binding().error();
if(error.hasError())
     qDebug() << error.description();

成员类型文档

enum QPropertyBindingError::Type

此枚举用于指定发生了哪种错误。

常量值描述
QPropertyBindingError::NoError0在评估绑定时未发生错误。
QPropertyBindingError::BindingLoop1由于某个属性依赖于其自身的值,因此停止了绑定评估。
QPropertyBindingError::EvaluationError2绑定求值因绑定循环以外的其他原因而停止。例如,当在绑定求值过程中发生异常时,QML 引擎会使用此值。
QPropertyBindingError::UnknownError3当其他两个值都不适用时使用的通用错误类型。调用description() 可能会提供详细信息。

成员函数文档

QPropertyBindingError::QPropertyBindingError()

默认情况下,QPropertyBindingError 对象的 hasError() 方法将返回 false,type 方法将返回NoError ,而description() 方法将返回一个空字符串。

QPropertyBindingError::QPropertyBindingError(QPropertyBindingError::Type type, const QString &description = QString())

创建一个类型为type 的QPropertyBindingError对象,其描述为description 。

QPropertyBindingError::QPropertyBindingError(const QPropertyBindingError &other)

从other 复制并实现 QPropertyBindingError 类。

QPropertyBindingError::QPropertyBindingError(QPropertyBindingError &&other)

将 QPropertyBindingError 从other 移出。other 将保持其默认状态。

[noexcept] QPropertyBindingError::~QPropertyBindingError()

销毁“QPropertyBindingError ”。

QString QPropertyBindingError::description() const

如果已设置QPropertyBindingError ,则返回该 的描述性错误信息。

QPropertyBindingError::Type QPropertyBindingError::type() const

返回QPropertyBindingError 的类型。

另请参阅 ` QPropertyBindingError::Type`。

QPropertyBindingError &QPropertyBindingError::operator=(QPropertyBindingError &&other)

将other 通过“移动赋值”操作赋值给此QPropertyBindingError 。other 将保持其默认状态。

QPropertyBindingError &QPropertyBindingError::operator=(const QPropertyBindingError &other)

将other 复制到QPropertyBindingError 。

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