적절한 함수 사용
qmllint에서는 이 경고 범주를 ' [use-proper-function] '로 표기합니다.
속성이 변형 속성입니다: 메서드일 수도 있고 아닐 수도 있습니다
무슨 일이 발생했나요?
var 유형의 속성을 호출 가능한 함수인 것처럼 사용했습니다.
이것이 왜 문제일까요?
이는 코드의 가독성에 영향을 미치며, 속성에 호출 가능한 함수가 포함되어 있지 않으면 QML 엔진에서 오류가 발생하고, QML 툴링에서 특정 메서드 최적화를 적용할 수 없게 됩니다.
예시
import QtQuick
Item {
property var fun: () => console.log("Hello")
Component.onCompleted: { fun(); }
}이 경고를 해결하려면, ` fun `을 호출할 수 있는 함수로 선언하십시오:
import QtQuick
Item {
function fun() {
console.log("Hello")
}
Component.onCompleted: { fun(); }
}Property는 QJSValue 속성입니다: 메서드일 수도 있고 아닐 수도 있습니다
무슨 일이 일어났나요?
QJSValue 유형의 속성을 호출 가능한 함수인 것처럼 사용했습니다.
참고: QJSValue 유형의속성은 C++에서만 정의할 수 있습니다.
왜 문제가 될까요?
이 속성은 호출될 의도가 아니었을 가능성이 매우 높으며, 런타임에 QML 엔진에서 오류가 발생하게 됩니다.
예시
import QtQuick
Rectangle {
// Rectangle has a property gradient of the type QJSValue
Component.onCompleted: { console.log(gradient()); }
}이 경고를 해결하려면 gradient 호출을 제거하십시오:
import QtQuick
Item {
// Rectangle has a property gradient of the type QJSValue
Component.onCompleted: { console.log(gradient); }
}또는, 해당 속성의 작성자라면 속성 정의를 일반적인 Q_INVOKABLE 메서드나 슬롯으로 대체하는 것을 고려해 보십시오. 이는 해당 함수가 QML에서 절대 변경될 의도가 없는 경우에만 가능합니다. 실제로 콜백을 저장해야 한다면 어쩔 도리가 없습니다.
신호가 속성에 의해 가려졌습니다
무슨 일이 일어난 걸까요?
속성에 의해 가려진 시그널을 호출했거나, 속성으로 시그널을 가린 경우입니다.
이것이 왜 문제일까요?
호출자는 가리는 속성이 아닌 신호를 호출할 것이라고 예상했을 가능성이 매우 높습니다. 이로 인해 런타임에 QML 엔진에서 오류가 발생할 수 있습니다.
예시
import QtQuick
Item {
component Base: Item {
signal helloSignal
}
Base {
property int helloSignal // shadows helloSignal inherited from Base
Component.onCompleted: { helloSignal(); }
}
}이 경고를 해결하려면 가리는 속성의 이름을 변경하십시오:
import QtQuick
Item {
component Base: Item {
signal helloSignal
}
Base {
property int helloSignal2 // does not shadow anymore
Component.onCompleted: { helloSignal(); }
}
}메서드가 속성에 의해 가려짐
{신호가 속성에 의해 가려짐}을 참조하십시오.
슬롯이 속성에 의해 가려짐
{신호가 속성에 의해 가려짐}을 참조하십시오.
속성이 메서드가 아닙니다
무슨 일이 일어난 것일까요?
var 이나 QJSValue 이외의 유형을 가진 속성을 호출 가능한 함수인 것처럼 사용했습니다.
이것이 왜 문제일까요?
해당 속성은 호출될 수 없으며, 런타임에 QML 엔진에서 오류가 발생합니다.
예시
이 경고를 해결하려면 호출을 제거하거나 ` hello `을 함수로 정의하십시오:
import QtQuick
Item {
property int hello
Component.onCompleted: { console.log(hello); }
// alternative:
function helloAlternative() { ... }
Component.onCompleted: { console.log(helloAlternative()); }
}© 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.