이 페이지에서

QQmlSA::PassManager Class

class QQmlSA::PassManager

정적 분석 단계를 통해 요소와 그 자식 요소를 분석할 수 있습니다. 더 보기...

헤더: #include <qqmlsa.h>
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::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)

상세 설명

멤버 함수 설명

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

요소가 지나가는 경로 root 와 그 모든 자식 요소에 대해 이 작업을 실행합니다.

std::unordered_map<quint32, QQmlSA::Binding> PassManager::bindingsByLocation() 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 `을 반환합니다.

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)

속성에 대한 정적 분석 단계를 등록합니다. pass 는 moduleName, typeName 및 propertyName 에 일치하는 모든 속성에 대해 실행됩니다.

propertyName 를 생략하면 typeName 및 moduleName 에 일치하는 모든 속성에 대해 이 분석 단계가 등록됩니다.

allowInheritance 를 true 로 설정하면, 유형에 대한 필터링에서 typeName 에서 파생된 유형도 허용하게 됩니다.

pass std::shared_ptr 로 전달되어 여러 요소에 대해 동일한 패스를 재사용할 수 있도록 합니다:

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

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

패스가 성공적으로 추가되면 true 를 반환하고, 그렇지 않으면 false 를 반환합니다. moduleName 및 typeName 로 지정된 Element 가 존재하지 않을 경우 패스 추가가 실패합니다.

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.