PassManager Class

class QQmlSA::PassManager

정적 분석 패스로 요소와 그 하위 요소를 분석할 수 있습니다. 더 보기...

Header: #include <PassManager>
CMake: find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)
target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler)
상태: 기술 미리보기

공용 함수

void analyze(const QQmlSA::Element &root)
std::unordered_map<quint32, QQmlSA::BindingInfo> bindingsByLocation() const
std::vector<std::shared_ptr<QQmlSA::ElementPass>> elementPasses() const
bool hasImportedModule(QAnyStringView module) const
bool isCategoryEnabled(QQmlSA::LoggerWarningId category) const
std::multimap<QString, QQmlSA::PropertyPassInfo> propertyPasses() 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)

상세 설명

멤버 함수 문서

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

root 및 모든 자식에 대한 요소 패스를 실행합니다.

std::unordered_map<quint32, QQmlSA::BindingInfo> PassManager::bindingsByLocation() const

소스 위치별로 바인딩을 반환합니다.

std::vector<std::shared_ptr<QQmlSA::ElementPass>> PassManager::elementPasses() const

엘리먼트 패스 목록을 반환합니다.

bool PassManager::hasImportedModule(QAnyStringView module) const

분석할 QML에서 module 이라는 모듈을 가져온 경우 true 을 반환하고, 그렇지 않은 경우 false 을 반환합니다.

이 함수는 특정 모듈에 특정한 패스를 등록하는 것을 건너뛰는 데 사용할 수 있습니다.

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

registerPropertyPass() 및 registerElementPass()도 참조하세요 .

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

category 경고가 활성화된 경우 true, 그렇지 않은 경우 false 를 반환합니다.

std::multimap<QString, QQmlSA::PropertyPassInfo> PassManager::propertyPasses() const

프로퍼티 패스 목록을 반환합니다.

void PassManager::registerElementPass(std::unique_ptr<QQmlSA::ElementPass> pass)

모든 요소에 대해 실행할 정적 분석 pass 을 등록합니다.

bool PassManager::registerPropertyPass(std::shared_ptr<QQmlSA::PropertyPass> pass, QAnyStringView moduleName, QAnyStringView typeName, QAnyStringView propertyName = QAnyStringView(), bool allowInheritance = true)

프로퍼티에 대한 정적 분석 패스를 등록합니다. passmoduleName, typeNamepropertyName 과 일치하는 모든 프로퍼티에 대해 실행됩니다.

propertyName 을 생략하면 typeNamemoduleName 과 일치하는 모든 프로퍼티에 대해 이 패스가 등록됩니다.

allowInheritancetrue 으로 설정하면 해당 유형에 대한 필터링이 typeName 에서 파생된 유형도 허용합니다.

passstd::shared_ptr 로 전달되어 여러 요소에서 동일한 패스를 재사용할 수 있습니다:

auto titleValiadorPass = std::make_shared<TitleValidatorPass>(manager);
manager->registerPropertyPass(titleValidatorPass,
                              "QtQuick", "Window", "title");
manager->registerPropertyPass(titleValidatorPass,
                              "QtQuick.Controls", "Dialog", "title");

참고: 너무 많은 항목에 대해 분석 패스를 실행하면 비용이 많이 들 수 있습니다. 따라서 일반적으로 moduleName, typeNamepropertyName 를 사용하여 패스의 속성 집합을 필터링하는 것이 좋습니다.

패스가 성공적으로 추가되면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다. moduleNametypeName 에 지정된 Element 이 존재하지 않으면 패스 추가에 실패합니다.

PropertyPass도 참조하세요 .

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