QQmlSA::PassManager Class

class QQmlSA::PassManager

Can analyze an element and its children with static analysis passes. More...

Header: #include <PassManager>
CMake: find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)
target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler)
Status: Technical Preview

Public Functions

void analyze(const QQmlSA::Element &root)
int bindingsByLocation() const
bool hasImportedModule(QAnyStringView module) const
bool isCategoryEnabled(QQmlSA::LoggerWarningId category) const

Detailed Description

Member Function Documentation

void PassManager::analyze(const QQmlSA::Element &root)

Runs the element passes over root and all its children.

int PassManager::bindingsByLocation() const

Returns bindings by their source location.

bool PassManager::hasImportedModule(QAnyStringView module) const

Returns true if the module named module has been imported by the QML to be analyzed, false otherwise.

This can be used to skip registering a pass which is specific to a specific module.

 if (passManager->hasImportedModule("QtPositioning"))
     passManager->registerElementPass(
        std::make_unique<PositioningPass>(passManager)
     );

See also registerPropertyPass() and registerElementPass().

bool PassManager::isCategoryEnabled(QQmlSA::LoggerWarningId category) const

Returns true if warnings of category are enabled, false otherwise.