QQmlSA::PropertyPass Class
class QQmlSA::PropertyPass所有属性静态分析传递的基类。更多
头文件: | #include <PropertyPass> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS QmlCompiler) target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler) |
继承: | QQmlSA::GenericPass |
状态: | 技术预览 |
公共函数
PropertyPass(QQmlSA::PassManager *manager) | |
virtual void | onBinding(const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Binding &binding, const QQmlSA::Element &bindingScope, const QQmlSA::Element &value) |
virtual void | onCall(const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Element &readScope, QQmlSA::SourceLocation location) |
virtual void | onRead(const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Element &readScope, QQmlSA::SourceLocation location) |
virtual void | onWrite(const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Element &expressionType, const QQmlSA::Element &writeScope, QQmlSA::SourceLocation location) |
成员函数文档
PropertyPass::PropertyPass(QQmlSA::PassManager *manager)
创建 PropertyPass 对象,并使用manager 引用通行证管理器。
[virtual]
void PropertyPass::onBinding(const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Binding &binding, const QQmlSA::Element &bindingScope, const QQmlSA::Element &value)
每当一个属性绑定到一个值时执行。
element 的属性propertyName 与bindingScope 中的value 绑定,binding 。
[virtual]
void PropertyPass::onCall(const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Element &readScope, QQmlSA::SourceLocation location)
在调用属性或方法时执行。
element 的属性或方法propertyName 被readScope 中定义在location 的指令作为函数调用。
注: 目前只支持对方法或属性的直接调用,不支持间接调用,例如将方法存储到 JavaScript 变量中,然后调用该变量。
[virtual]
void PropertyPass::onRead(const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Element &readScope, QQmlSA::SourceLocation location)
每当读取一个属性时执行。
element 的属性propertyName 由readScope 中的一条指令读取,该指令定义在location 。
如果属性propertyName 作为函数调用,也会执行该指令,因为这需要先读取属性。
[virtual]
void PropertyPass::onWrite(const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Element &expressionType, const QQmlSA::Element &writeScope, QQmlSA::SourceLocation location)
每当属性被写入时执行。
location 中定义的writeScope 中的指令写入element 的属性propertyName 。写入propertyName 的表达式类型是expressionType 。
© 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.