I've got a delegate attached to my TableViewColumn
that contains a MouseArea
. I use the MouseArea
to detect double clicks on individual cells in the table, which allows me to show a TextField
for editing purposes.
The problem is the delegate MouseArea
blocks mouse events from propagating through to TableView
. This means that the selection behaviour of TableView
no longer works. Specifically, I have SelectionMode.ExtendedSelection
enabled.
The MouseArea
child item is simple and originally looked like this:
MouseArea{
id: mousearea
anchors.fill: parent
onDoubleClicked: {
showTextField()
}
}
After consulting the documentation, it looked like this should work:
MouseArea{
id: mousearea
anchors.fill: parent
propagateComposedEvents: true // new
onDoubleClicked: {
showTextField()
}
onPressed: mouse.accepted = false // new
}
Which it does, except now I cannot pick up double click events anymore (in MouseArea
)! Which makes sense, as it states later in the documentation:
pressed(MouseEvent mouse)
When handling this signal, use the accepted property of the mouse parameter to control whether this MouseArea handles the press and all future mouse events until release. The default is to accept the event and not allow other MouseAreas beneath this one to handle the event. If accepted is set to false, no further events will be sent to this MouseArea until the button is next pressed.
There does not seem to be a way to capture mouse events for individual cells at the TableView
level. It's my first day playing around with QML, so I might have missed something obvious here, but what are my options? Note I'm using PyQt.
MouseAreas
overlap and what is the behavior you want to have for each? – derM