QScxmlError Class

QScxmlError 类描述了Qt SCXML 状态机在解析 SCXML 文件时返回的错误。更多

头文件: #include <QScxmlError>
CMake: find_package(Qt6 REQUIRED COMPONENTS Scxml)
target_link_libraries(mytarget PRIVATE Qt6::Scxml)
qmake: QT += scxml

属性

公共功能

QScxmlError()
QScxmlError(const QString &fileName, int line, int column, const QString &description)
QScxmlError(const QScxmlError &other)
~QScxmlError()
int column() const
QString description() const
QString fileName() const
bool isValid() const
int line() const
QString toString() const
QScxmlError &operator=(const QScxmlError &other)

详细说明

另请参见 QScxmlStateMachineQScxmlCompiler

属性文档

[read-only] column : const int

该属性保存发生 SCXML 错误的列编号。

访问功能:

int column() const

[read-only] description : const QString

该属性包含 SCXML 错误的描述。

访问功能:

QString description() const

[read-only] fileName : const QString

该属性包含发生 SCXML 错误的文件名。

访问功能:

QString fileName() const

[read-only] line : const int

该属性保存发生 SCXML 错误的行号。

访问功能:

int line() const

[read-only] valid : const bool

此属性表示 SCXML 错误是否有效。

访问函数:

bool isValid() const

成员函数文档

QScxmlError::QScxmlError()

创建新的无效 SCXML 错误。

QScxmlError::QScxmlError(const QString &fileName, int line, int column, const QString &description)

创建一个新的有效 SCXML 错误,其中包含错误信息description 以及发生错误的fileNamelinecolumn

QScxmlError::QScxmlError(const QScxmlError &other)

构造other 的副本。

[noexcept] QScxmlError::~QScxmlError()

销毁 SCXML 错误。

int QScxmlError::column() const

返回发生错误的列。

注: 属性列的获取函数。

QString QScxmlError::description() const

返回错误信息。

注: 属性描述的获取函数。

QString QScxmlError::fileName() const

返回发生错误的文件名。

注: 属性 fileName 的获取函数。

bool QScxmlError::isValid() const

如果错误有效,则返回true ,否则返回false 。无效错误只能通过调用默认构造函数或赋值无效错误来创建。

注: 属性valid 的获取函数。

int QScxmlError::line() const

返回发生错误的行。

注: 属性行的获取函数。

QString QScxmlError::toString() const

此便捷方法可将错误信息转换为字符串。返回错误信息,格式为"文件名:行:列:错误:描述"

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

为 SCXML 错误分配other 并返回 SCXML 错误的引用。

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