[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml/TableView: fix context button width
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Thu Mar 10 16:18:56 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
bb1053f7 by Prince Gupta at 2022-03-10T15:57:16+00:00
qml/TableView: fix context button width
- - - - -
93f1b08a by Prince Gupta at 2022-03-10T15:57:16+00:00
qml/VideoAll: fix context menu popup pos in list mode
- - - - -
9cf9bd61 by Prince Gupta at 2022-03-10T15:57:16+00:00
qml: select index on context button click in TableView
this way it mirrors the behaviour with GridViews
- - - - -
2 changed files:
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/widgets/qml/TableViewDelegate.qml
Changes:
=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -346,8 +346,7 @@ FocusScope {
onItemDoubleClicked: root.onDoubleClick(model)
- onContextMenuButtonClicked: root.contextMenu.popup(modelSelect.selectedIndexes,
- menuParent.mapToGlobal(0,0))
+ onContextMenuButtonClicked: root.contextMenu.popup(modelSelect.selectedIndexes, globalMousePos)
onRightClick: root.contextMenu.popup(modelSelect.selectedIndexes, globalMousePos)
=====================================
modules/gui/qt/widgets/qml/TableViewDelegate.qml
=====================================
@@ -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)
@@ -196,12 +198,16 @@ T.Control {
iconText: VLCIcons.ellipsis
- size: VLCStyle.icon_medium
+ size: root._contextButtonHorizontalSpace
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)
+ }
}
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/92db822f89526b15b5cf1f1ea8e3517559b97a07...9cf9bd61bd12e3728d3a4b515e4594b94fb53bdf
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/92db822f89526b15b5cf1f1ea8e3517559b97a07...9cf9bd61bd12e3728d3a4b515e4594b94fb53bdf
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list