QML 정적 분석 3 - Fixit 힌트
이 장에서는 수정 힌트를 추가하여 사용자 정의 경고를 개선하는 방법을 배웁니다.
지금까지는 경고 메시지만 생성했습니다. 하지만 때로는 사용자에게 코드를 수정하는 방법에 대한 팁을 추가하고 싶을 수도 있습니다. 이를 위해 FixSuggestion 의 인스턴스를 emitWarning 에 전달할 수 있습니다. 수정 제안은 항상 수정해야 할 내용에 대한 설명과 적용 위치로 구성됩니다. 또한 대체 텍스트를 포함할 수도 있습니다. 기본적으로 대체 텍스트는 진단 메시지에만 표시됩니다. 하지만 ` FixSuggestion`에서 ` setAutoApplicable(true) `를 호출하면, 사용자는 qmllint나 QML Language Server를 통해 수정 사항을 자동으로 적용할 수 있습니다. 결과 코드가 유효한 경우에만 해당 제안을 ‘자동 적용 가능’으로 표시해야 합니다.
© 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.