[vlc-commits] qml: define a highlight margin in KeyNavigableListView
    Pierre Lamot 
    git at videolan.org
       
    Fri Jan 10 15:06:41 CET 2020
    
    
  
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Dec 19 11:55:49 2019 +0100| [888d1f338e34e4a750a9730bd09180abe19440ce] | committer: Jean-Baptiste Kempf
qml: define a highlight margin in KeyNavigableListView
  this allows to keep the hightlighted item centered while navigating
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=888d1f338e34e4a750a9730bd09180abe19440ce
---
 modules/gui/qt/widgets/qml/KeyNavigableListView.qml | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/modules/gui/qt/widgets/qml/KeyNavigableListView.qml b/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
index fe71af1cd7..68590b12e3 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableListView.qml
@@ -58,6 +58,8 @@ NavigableFocusScope {
     property alias section: view.section
     property alias orientation: view.orientation
 
+    property int highlightMargin: VLCStyle.margin_large
+
     Accessible.role: Accessible.List
 
     function nextPage() {
@@ -105,6 +107,11 @@ NavigableFocusScope {
         contentWidth: contentItem.childrenRect.width
         contentHeight: contentItem.childrenRect.height
 
+
+        preferredHighlightBegin : highlightMargin + (headerItem ? headerItem.height : 0)
+        preferredHighlightEnd : height - highlightMargin
+        highlightRangeMode: ListView.ApplyRange
+
         focus: true
 
         clip: true
    
    
More information about the vlc-commits
mailing list