Skip to content
Snippets Groups Projects
Commit 9cf9bd61 authored by Prince Gupta's avatar Prince Gupta :speech_balloon: Committed by Hugo Beauzée-Luyssen
Browse files

qml: select index on context button click in TableView

this way it mirrors the behaviour with GridViews
parent 93f1b08a
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,15 @@ T.Control {
ListView.delayRemove: dragActive
function selectAndFocus(modifiers, focusReason) {
selectionDelegateModel.updateSelection(modifiers, view.currentIndex, index)
view.currentIndex = index
view.positionViewAtIndex(index, ListView.Contain)
delegate.forceActiveFocus(focusReason)
}
// Connections
Connections {
......@@ -104,14 +113,7 @@ T.Control {
onClicked: {
if ((mouse.button === Qt.LeftButton)
|| !selectionDelegateModel.isSelected(root.model.index(index, 0))) {
selectionDelegateModel.updateSelection(mouse.modifiers, view.currentIndex, index)
view.positionViewAtIndex(index, ListView.Contain)
view.currentIndex = index
delegate.forceActiveFocus(Qt.MouseFouseReason)
delegate.selectAndFocus(mouse.modifiers, Qt.MouseFocusReason)
}
if (mouse.button === Qt.RightButton)
......@@ -200,8 +202,12 @@ T.Control {
visible: delegate.hovered
onClicked: root.contextMenuButtonClicked(this, delegate.rowModel
, contextButton.mapToGlobal(VLCStyle.margin_xsmall, contextButton.height / 2 + VLCStyle.fontHeight_normal))
onClicked: {
delegate.selectAndFocus(Qt.NoModifier, Qt.MouseFocusReason)
var pos = contextButton.mapToGlobal(VLCStyle.margin_xsmall, contextButton.height / 2 + VLCStyle.fontHeight_normal)
root.contextMenuButtonClicked(this, delegate.rowModel, pos)
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment