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::NoErrorhasError() 返回 false。

外部QProperty<int>prop.binding().errorQPropertyBindingErrorerror=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 将返回NoErrordescription() 将返回空字符串。

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

构造一个type 类型的 QPropertyBindingError,其描述为description

QPropertyBindingError::QPropertyBindingError(const QPropertyBindingError &other)

other 复制构造 QPropertyBindingError。

QPropertyBindingError::QPropertyBindingError(QPropertyBindingError &&other)

Move-constructs QPropertyBindingError fromother.other 将保持默认状态。

[noexcept] QPropertyBindingError::~QPropertyBindingError()

摧毁QPropertyBindingError.

QString QPropertyBindingError::description() const

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

QPropertyBindingError::Type QPropertyBindingError::type() const

返回QPropertyBindingError 的类型。

另请参阅 QPropertyBindingError::Type

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

Move-assignsotherQPropertyBindingErrorother 将保持默认状态。

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

otherQPropertyBindingError

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