[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: don't lose selection on context button in table view

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Jun 24 10:07:27 UTC 2022



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
1ea09518 by Prince Gupta at 2022-06-24T09:42:09+00:00
qml: don't lose selection on context button in table view

- - - - -
001498aa by Prince Gupta at 2022-06-24T09:42:09+00:00
qml: simplify selection condition

- - - - -


1 changed file:

- modules/gui/qt/widgets/qml/TableViewDelegate.qml


Changes:

=====================================
modules/gui/qt/widgets/qml/TableViewDelegate.qml
=====================================
@@ -111,8 +111,7 @@ T.Control {
             onPressed: _modifiersOnLastPress = mouse.modifiers
 
             onClicked: {
-                if ((mouse.button === Qt.LeftButton)
-                        || !selectionDelegateModel.isSelected(root.model.index(index, 0))) {
+                if ((mouse.button === Qt.LeftButton) || !delegate.selected) {
                     delegate.selectAndFocus(mouse.modifiers, Qt.MouseFocusReason)
                 }
 
@@ -138,17 +137,15 @@ T.Control {
             drag.onActiveChanged: {
                 // NOTE: Perform the "click" action because the click action is only executed on mouse
                 //       release (we are in the pressed state) but we will need the updated list on drop.
-                if (drag.active
-                    &&
-                    selectionDelegateModel.isSelected(root.model.index(index, 0)) == false) {
-
-                    selectionDelegateModel.updateSelection(_modifiersOnLastPress, view.currentIndex,
-                                                           index);
+                if (drag.active && !delegate.selected) {
+                    selectionDelegateModel.updateSelection(_modifiersOnLastPress
+                                                           , view.currentIndex
+                                                           , index)
                 } else if (root.dragItem) {
-                    root.dragItem.Drag.drop();
+                    root.dragItem.Drag.drop()
                 }
 
-                root.dragItem.Drag.active = drag.active;
+                root.dragItem.Drag.active = drag.active
             }
         }
     }
@@ -203,7 +200,8 @@ T.Control {
                 visible: delegate.hovered
 
                 onClicked: {
-                    delegate.selectAndFocus(Qt.NoModifier, Qt.MouseFocusReason)
+                    if (!delegate.selected)
+                        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/0391b33a9029c47e5c8ba27bd7493fac1ab8a232...001498aa1e5eb85ba64e1637c7887b28f9039972

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0391b33a9029c47e5c8ba27bd7493fac1ab8a232...001498aa1e5eb85ba64e1637c7887b28f9039972
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