[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml/KeyNavigableTableView: account for section width in content width

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jan 15 16:06:50 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
ee73ef5c by Prince Gupta at 2022-01-15T15:52:47+00:00
qml/KeyNavigableTableView: account for section width in content width

fixes table section texts get hidden if view doesn't have enough space

- - - - -
b7389073 by Prince Gupta at 2022-01-15T15:52:47+00:00
qml/KeyNavigableTableView: fix list items and headers overlapping

- - - - -
88b409c3 by Prince Gupta at 2022-01-15T15:52:47+00:00
qml/KeyNavigableTableView: make sure to have the item visible when clicked

- - - - -


2 changed files:

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


Changes:

=====================================
modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
=====================================
@@ -47,6 +47,8 @@ FocusScope {
         text: model.text || ""
     }
 
+    readonly property real sectionWidth: !!section.property ? VLCStyle.table_section_width : 0
+
     readonly property real usedRowSpace: {
         var s = 0
         for (var i in sortModel)
@@ -250,7 +252,7 @@ FocusScope {
             readonly property alias contentWidth: row.width
             property alias loadedHeader: headerLoader.item
 
-            width: view.width
+            width: Math.max(view.width, root.usedRowSpace + root.sectionWidth)
             height: col.height
             color: headerColor
             visible: view.modelCount > 0
@@ -291,7 +293,7 @@ FocusScope {
                 Row {
                     id: row
 
-                    x: Math.max(0, view.width - root.usedRowSpace) / 2
+                    x: Math.max(0, view.width - root.usedRowSpace) / 2 + root.sectionWidth
                     leftPadding: VLCStyle.margin_xxxsmall
                     rightPadding: VLCStyle.margin_xxxsmall
                     topPadding: root.headerTopPadding
@@ -355,7 +357,7 @@ FocusScope {
         delegate: TableViewDelegate {}
 
         flickableDirection: Flickable.AutoFlickDirection
-        contentWidth: root.usedRowSpace
+        contentWidth: root.usedRowSpace + root.sectionWidth
 
         onSelectAll: selectionDelegateModel.selectAll()
         onSelectionUpdated: selectionDelegateModel.updateSelection( keyModifiers, oldIndex, newIndex )


=====================================
modules/gui/qt/widgets/qml/TableViewDelegate.qml
=====================================
@@ -40,11 +40,11 @@ T.Control {
 
     // Settings
 
-    width: Math.max(view.width, content.implicitWidth)
+    width: Math.max(view.width, content.implicitWidth) + root.sectionWidth
 
     height: root.rowHeight
 
-    leftPadding: Math.max(0, view.width - root.usedRowSpace) / 2
+    leftPadding: Math.max(0, view.width - root.usedRowSpace) / 2 + root.sectionWidth
 
     hoverEnabled: true
     
@@ -102,19 +102,20 @@ T.Control {
             onPressed: _modifiersOnLastPress = mouse.modifiers
 
             onClicked: {
-                if (mouse.button === Qt.LeftButton
-                    ||
-                    selectionDelegateModel.isSelected(root.model.index(index, 0)) == false) {
+                if ((mouse.button === Qt.LeftButton)
+                        || !selectionDelegateModel.isSelected(root.model.index(index, 0))) {
+
+                    selectionDelegateModel.updateSelection(mouse.modifiers, view.currentIndex, index)
 
-                    selectionDelegateModel.updateSelection(mouse.modifiers, view.currentIndex, index);
+                    view.positionViewAtIndex(index, ListView.Contain)
 
-                    view.currentIndex = index;
+                    view.currentIndex = index
 
-                    delegate.forceActiveFocus();
+                    delegate.forceActiveFocus(Qt.MouseFouseReason)
                 }
 
                 if (mouse.button === Qt.RightButton)
-                    root.rightClick(delegate, rowModel, hoverArea.mapToGlobal(mouse.x, mouse.y));
+                    root.rightClick(delegate, rowModel, hoverArea.mapToGlobal(mouse.x, mouse.y))
             }
 
             onPositionChanged: {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/af0b96127149dc8b18b3127918d9824b1b320fbc...88b409c32714531211b3b1e19edd9025cf62a6dc

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/af0b96127149dc8b18b3127918d9824b1b320fbc...88b409c32714531211b3b1e19edd9025cf62a6dc
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list