Hi All,
I have a TreeView as shown here
TreeView {
id:treeView
anchors.fill: parent
model: treemodel
TableViewColumn {
title: "Name"
role: "name"
delegate: EditableDelegate{
MouseArea {
id: columnMouseArea
anchors.fill: parent
acceptedButtons: Qt.RightButton
propagateComposedEvents: true
onClicked: {
console.log("Test")
}
}
}
}
}
TreeView {
id:treeView
anchors.fill: parent
model: treemodel
TableViewColumn {
title: "Name"
role: "name"
delegate: EditableDelegate{
MouseArea {
id: columnMouseArea
anchors.fill: parent
acceptedButtons: Qt.RightButton
propagateComposedEvents: true
onClicked: {
console.log("Test")
}
}
}
}
}
To copy to clipboard, switch view to plain text mode
The EditableDelegate is defined in a different file
Item{
Text {
id: label
text: model.name
color: "blue"
font.family: "Open Sans"
verticalAlignment: Text.AlignVCenter
anchors.leftMargin: 5
elide: "ElideRight"
anchors.verticalCenter: parent.verticalCenter
width: parent.width
}
}
Item{
Text {
id: label
text: model.name
color: "blue"
font.family: "Open Sans"
verticalAlignment: Text.AlignVCenter
anchors.leftMargin: 5
elide: "ElideRight"
anchors.verticalCenter: parent.verticalCenter
width: parent.width
}
}
To copy to clipboard, switch view to plain text mode
However, I get the following error "Cannot assign to non-existent default property" at the treeview where the Mouse area is defined
I need the following design as I want to reuse the delegate with another treeview
Could you suggest a workaround for this approach?
Bookmarks