Qt 6.2.0 Ubuntu 20.04
內容.qml
PathView {
id: view
function myFunc(type) {
console.log(type)
}
}
主.qml
ApplicationWindow {
id: window
Item {
id: item
Content {
id: content
}
}
Item {
content.myFunc(1) // <-- Expected token :
}
}
什么是正確的呼叫語法myFunc()
?
uj5u.com熱心網友回復:
不允許在 QML 專案內實作邏輯,您可以在可點擊區域下呼叫 myFunc,如下所示
MouseArea {
onClicked: {
content.myFunc()
}
}
您可以閱讀更多內容以從實施游戲邏輯中獲得更好的理解
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/434936.html
上一篇:使用四段繪制貝塞爾曲線