1 回答

TA貢獻1797條經驗 獲得超6個贊
對于舊的(編輯過的)問題:您應該在控制臺日志行中
使用styleData.row而不是styleData.value
對于新問題:
您的列有一個委托,它會覆蓋表的項目委托。然后,當單擊第一列時,它實際上是調用控制臺日志的行的委托。
您可以通過將列委托更改為來解決此問題:
CC.TableViewColumn
{
role: "aaa"
title: "AAA"
width: 100
delegate: Item
{
Rectangle
{
anchors.left: parent.left
id: pic
radius: 100
height: 15; width: 15; color: "red"
}
Text
{
id: text_id
anchors.left: pic.right
anchors.leftMargin: 10
text: styleData.value
}
MouseArea
{
id: ma2
anchors.fill: parent
onClicked: {
console.log(text_id.text)
}
}
}
}
添加回答
舉報