QML 정적 분석 3 - 픽스잇 힌트

이 장에서는 픽스잇 힌트를 사용하여 사용자 지정 경고를 수정하여 개선하는 방법을 배웁니다.

지금까지는 경고 메시지만 만들었습니다. 그러나 때로는 사용자에게 코드를 수정하는 방법에 대한 팁을 추가하고 싶을 때도 있습니다. 이를 위해 FixSuggestion 의 인스턴스를 emitWarning 으로 전달할 수 있습니다. 수정 제안은 항상 무엇을 수정해야 하는지에 대한 설명과 수정해야 할 위치로 구성됩니다. 또한 대체 텍스트를 포함할 수도 있습니다. 기본적으로 대체 텍스트는 진단 메시지에만 표시됩니다. 그러나 사용자는 FixSuggestion 에서 setAutoApplicable(true) 을 호출하여 qmllint 또는 QML 언어 서버를 통해 자동으로 수정 사항을 적용할 수 있습니다. 결과 코드가 유효한 경우에만 제안을 자동 적용 가능으로 표시하는 것이 중요합니다.

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