[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: use animation when positioning the flickable in `BrowseHomeDisplay`

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sat Jul 26 17:21:36 UTC 2025



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


Commits:
ec2f0aad by Fatih Uzunoglu at 2025-07-26T16:41:10+00:00
qml: use animation when positioning the flickable in `BrowseHomeDisplay`

- - - - -
8adf1e26 by Fatih Uzunoglu at 2025-07-26T16:41:10+00:00
qml: use animation when positioning the flickable in `HomePage`

- - - - -


2 changed files:

- modules/gui/qt/medialibrary/qml/HomePage.qml
- modules/gui/qt/network/qml/BrowseHomeDisplay.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/HomePage.qml
=====================================
@@ -97,6 +97,20 @@ T.Page {
 
         ScrollBar.vertical: Widgets.ScrollBarExt {}
 
+        // This behavior allows to have similar "smooth" animation
+        // that Qt views have with `highlightFollowsCurrentItem`.
+        Behavior on contentY {
+            id: contentYBehavior
+
+            enabled: false
+
+            // NOTE: Usage of `SmoothedAnimation` is intentional here.
+            SmoothedAnimation {
+                duration: VLCStyle.duration_veryLong
+                easing.type: Easing.InOutSine
+            }
+        }
+
         DefaultFlickableScrollHandler {}
 
         Component.onCompleted: {
@@ -160,7 +174,9 @@ T.Page {
             }
 
             onActiveFocusChanged: {
+                contentYBehavior.enabled = true
                 Helpers.positionFlickableToContainItem(flickable, this)
+                contentYBehavior.enabled = false
             }
         }
 
@@ -249,15 +265,20 @@ T.Page {
                 onActiveFocusChanged: {
                     if (activeFocus) {
                         const item = currentItem?.currentItem ?? currentItem?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
+                        contentYBehavior.enabled = true
                         Helpers.positionFlickableToContainItem(flickable, item ?? this)
+                        contentYBehavior.enabled = false
                     }
                 }
 
                 onCurrentIndexChanged: {
                     if (activeFocus) {
                         const item = currentItem?.currentItem ?? currentItem?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
-                        if (item)
+                        if (item) {
+                            contentYBehavior.enabled = true
                             Helpers.positionFlickableToContainItem(flickable, item)
+                            contentYBehavior.enabled = false
+                        }
                     }
                 }
             }
@@ -321,15 +342,20 @@ T.Page {
                 onActiveFocusChanged: {
                     if (activeFocus) {
                         const item = currentItem?.currentItem ?? currentItem?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
+                        contentYBehavior.enabled = true
                         Helpers.positionFlickableToContainItem(flickable, item ?? this)
+                        contentYBehavior.enabled = false
                     }
                 }
 
                 onCurrentIndexChanged: {
                     if (activeFocus) {
                         const item = currentItem?.currentItem ?? currentItem?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
-                        if (item)
+                        if (item) {
+                            contentYBehavior.enabled = true
                             Helpers.positionFlickableToContainItem(flickable, item)
+                            contentYBehavior.enabled = true
+                        }
                     }
                 }
             }
@@ -385,15 +411,20 @@ T.Page {
                 onActiveFocusChanged: {
                     if (activeFocus) {
                         const item = currentItem?.currentItem ?? currentItem?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
+                        contentYBehavior.enabled = true
                         Helpers.positionFlickableToContainItem(flickable, item ?? this)
+                        contentYBehavior.enabled = false
                     }
                 }
 
                 onCurrentIndexChanged: {
                     if (activeFocus) {
                         const item = currentItem?.currentItem ?? currentItem?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
-                        if (item)
+                        if (item) {
+                            contentYBehavior.enabled = true
                             Helpers.positionFlickableToContainItem(flickable, item)
+                            contentYBehavior.enabled = false
+                        }
                     }
                 }
             }


=====================================
modules/gui/qt/network/qml/BrowseHomeDisplay.qml
=====================================
@@ -136,6 +136,20 @@ FocusScope {
         contentWidth: column.width
         contentHeight: column.height
 
+        // This behavior allows to have similar "smooth" animation
+        // that Qt views have with `highlightFollowsCurrentItem`.
+        Behavior on contentY {
+            id: contentYBehavior
+
+            enabled: false
+
+            // NOTE: Usage of `SmoothedAnimation` is intentional here.
+            SmoothedAnimation {
+                duration: VLCStyle.duration_veryLong
+                easing.type: Easing.InOutSine
+            }
+        }
+
         DefaultFlickableScrollHandler { }
 
         Navigation.parentItem: root
@@ -287,15 +301,20 @@ FocusScope {
         onActiveFocusChanged: {
             if (activeFocus) {
                 const item = _currentView?.currentItem ?? _currentView?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
+                contentYBehavior.enabled = true
                 Helpers.positionFlickableToContainItem(flickable, item ?? this)
+                contentYBehavior.enabled = false
             }
         }
 
         onCurrentIndexChanged: {
             if (activeFocus) {
                 const item = _currentView?.currentItem ?? _currentView?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
-                if (item)
+                if (item) {
+                    contentYBehavior.enabled = true
                     Helpers.positionFlickableToContainItem(flickable, item)
+                    contentYBehavior.enabled = false
+                }
             }
         }
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e5ef5bbc6cf70b5fa4d8805e59fd968ff90f7612...8adf1e26d20c35373a97a79ffb58a62dad311db1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e5ef5bbc6cf70b5fa4d8805e59fd968ff90f7612...8adf1e26d20c35373a97a79ffb58a62dad311db1
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