[vlc-commits] qml: hide playlist list fade out when relative two items are hovered or selected

Fatih Uzunoglu git at videolan.org
Tue Aug 18 17:14:55 CEST 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Sun Jul 12 20:16:18 2020 +0300| [0099a77d11356958929cb97ea351b93cea7bc086] | committer: Pierre Lamot

qml: hide playlist list fade out when relative two items are hovered or selected

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0099a77d11356958929cb97ea351b93cea7bc086
---

 modules/gui/qt/playlist/qml/PlaylistListView.qml | 36 ++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index 18458fd173..b801adb116 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -271,6 +271,8 @@ Widgets.NavigableFocusScope {
                 model: root.plmodel
                 modelCount: root.plmodel.count
 
+                fadeColor: root.backgroundColor
+
                 property int shiftIndex: -1
                 property string mode: "normal"
 
@@ -284,6 +286,26 @@ Widgets.NavigableFocusScope {
                         if (view.currentIndex == -1 &&  root.plmodel.count > 0)
                             view.currentIndex = 0
                     }
+                    onSelectedCountChanged: {
+                        var selectedIndexes = root.plmodel.getSelection()
+                        var modelCount = root.plmodel.count
+
+                        if (modelCount === 0 || selectedIndexes.length === 0)
+                            return
+
+                        var bottomItemIndex = view.listView.indexAt(view.listView.contentX, (view.listView.contentY + view.height) - 2)
+                        var topItemIndex    = view.listView.indexAt(view.listView.contentX, view.listView.contentY + 2)
+
+                        if (topItemIndex !== -1 && (root.plmodel.isSelected(topItemIndex) || (modelCount >= 2 && root.plmodel.isSelected(topItemIndex + 1))))
+                            view.fadeRectTopHovered = true
+                        else
+                            view.fadeRectTopHovered = false
+
+                        if (bottomItemIndex !== -1 && (root.plmodel.isSelected(bottomItemIndex) || (root.plmodel.isSelected(bottomItemIndex - 1))))
+                            view.fadeRectBottomHovered = true
+                        else
+                            view.fadeRectBottomHovered = false
+                    }
                 }
 
                 footer: DropArea {
@@ -394,6 +416,20 @@ Widgets.NavigableFocusScope {
                                 root.plmodel.moveItemsPre(root.plmodel.getSelection(), target)
                             }
                         }
+
+                        onHoveredChanged: {
+                            var bottomItemIndex = view.listView.indexAt(plitem.width / 2, (view.listView.contentY + view.height) - 2)
+                            var topItemIndex = view.listView.indexAt(plitem.width / 2, view.listView.contentY + 2)
+
+                            if(bottomItemIndex !== -1 && model.index >= bottomItemIndex - 1)
+                            {
+                                view.fadeRectBottomHovered = plitem.hovered
+                            }
+                            if(topItemIndex !== -1 && model.index <= topItemIndex + 1)
+                            {
+                                view.fadeRectTopHovered = plitem.hovered
+                            }
+                        }
                     }
 
                     Rectangle {



More information about the vlc-commits mailing list