QQmlSA::PassManager Class
class QQmlSA::PassManagerPuede analizar un elemento y sus hijos con pases de análisis estático. Más...
| Cabecera: | #include <PassManager> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler) |
Funciones públicas
| void | analyze(const QQmlSA::Element &root) |
| std::unordered_map<quint32, QQmlSA::Binding> | bindingsByLocation() const |
| bool | hasImportedModule(QAnyStringView module) const |
| bool | isCategoryEnabled(QQmlSA::LoggerWarningId category) const |
| void | registerElementPass(std::unique_ptr<QQmlSA::ElementPass> pass) |
| bool | registerPropertyPass(std::shared_ptr<QQmlSA::PropertyPass> pass, QAnyStringView moduleName, QAnyStringView typeName, QAnyStringView propertyName = QAnyStringView(), bool allowInheritance = true) |
Documentación de las funciones de los miembros
void PassManager::analyze(const QQmlSA::Element &root)
Pasa el elemento sobre root y todos sus hijos.
std::unordered_map<quint32, QQmlSA::Binding> PassManager::bindingsByLocation() const
Devuelve los enlaces por su ubicación de origen.
bool PassManager::hasImportedModule(QAnyStringView module) const
Devuelve true si el módulo denominado module ha sido importado por el QML que se va a analizar, false en caso contrario.
Puede utilizarse para omitir el registro de un pase específico para un módulo concreto.
if (passManager->hasImportedModule("QtPositioning")) passManager->registerElementPass( std::make_unique<PositioningPass>(passManager) );
Véase también registerPropertyPass() y registerElementPass().
bool PassManager::isCategoryEnabled(QQmlSA::LoggerWarningId category) const
Devuelve true si las advertencias de category están activadas, false en caso contrario.
void PassManager::registerElementPass(std::unique_ptr<QQmlSA::ElementPass> pass)
Registra un análisis estático pass que se ejecutará en todos los elementos.
bool PassManager::registerPropertyPass(std::shared_ptr<QQmlSA::PropertyPass> pass, QAnyStringView moduleName, QAnyStringView typeName, QAnyStringView propertyName = QAnyStringView(), bool allowInheritance = true)
Registra un pase de análisis estático para las propiedades. pass se ejecutará en todas las propiedades que coincidan con moduleName, typeName y propertyName.
Omitiendo propertyName se registrará este pase para todas las propiedades que coincidan con typeName y moduleName.
Establecer allowInheritance como true significa que el filtrado del tipo también acepta tipos derivados de typeName.
pass se pasa como std::shared_ptr para permitir la reutilización del mismo pase en múltiples elementos:
auto titleValiadorPass = std::make_shared<TitleValidatorPass>(manager); manager->registerPropertyPass(titleValidatorPass, "QtQuick", "Window", "title"); manager->registerPropertyPass(titleValidatorPass, "QtQuick.Controls", "Dialog", "title");
Nota: Ejecutar pases de análisis en demasiados elementos puede resultar costoso. Por ello, suele ser conveniente filtrar el conjunto de propiedades de un pase mediante moduleName, typeName y propertyName.
Devuelve true si el pase se ha añadido correctamente, false en caso contrario. La adición de un pase falla cuando el Element especificado por moduleName y typeName no existe.
Véase también PropertyPass.
© 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.