After some research I get this far but now I don't know why the value doesn't show up. Any help?
TableView {
id: view
anchors.margins: 10
anchors.fill: parent
model: dataModel
clip: true
TableViewColumn {
width: 100
title: "Name"
role: "fileName"
}
itemDelegate: Item {
Text {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
renderType: Text.NativeRendering
text: styleData.value
}
}
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.LeftButton
propagateComposedEvents: true
onPressed:
{
if(mouse.button == Qt.LeftButton){
console.log(view.value) // ??? styleData.value doen't work neihter
}
mouse.accepted = false
}
onReleased: mouse.accepted = false
onPressAndHold: mouse.accepted = false
}
}
TableView {
id: view
anchors.margins: 10
anchors.fill: parent
model: dataModel
clip: true
TableViewColumn {
width: 100
title: "Name"
role: "fileName"
}
itemDelegate: Item {
Text {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
renderType: Text.NativeRendering
text: styleData.value
}
}
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.LeftButton
propagateComposedEvents: true
onPressed:
{
if(mouse.button == Qt.LeftButton){
console.log(view.value) // ??? styleData.value doen't work neihter
}
mouse.accepted = false
}
onReleased: mouse.accepted = false
onPressAndHold: mouse.accepted = false
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks