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
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to