[vlc-commits] [Git][videolan/vlc][master] qml: enable default transitions only when drag and drop is feasible in `ListViewExt`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Apr 19 08:36:47 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
6c6b68d8 by Fatih Uzunoglu at 2025-04-19T08:20:03+00:00
qml: enable default transitions only when drag and drop is feasible in `ListViewExt`
I wanted to use the Component approach, with relying on the JS engine's garbage
collection, like I do in the scroll bar case (not creating the scroll bar when
the scroll bar is irrelevant) but it was not possible here. It seems that
Transition sets up the animations based on its parent, and I could not find
a "target" property in Transition.
Instead, I simply bind `enabled` of the transition to whether `acceptDropFunc`
is valid. Testing `acceptDropFunc` is a good practice when checking whether
the drag and drop is feasible in the view.
This fixes the problem of the initial items getting animated when media library
views load the (initial) items asynchronously. We don't want the initial items to
be animated. The playlist media library views are going to be still be affected
by this, as they support drag and drop and we want the transitions there, but
there is not much to do about that here.
- - - - -
1 changed file:
- modules/gui/qt/widgets/qml/ListViewExt.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/ListViewExt.qml
=====================================
@@ -307,6 +307,11 @@ ListView {
Accessible.role: Accessible.List
add: Transition {
+ // Transition is relevant when drag and drop is feasible.
+ // Component approach can not be used here because `Transition`
+ // does not have a "target" property, and wants a valid parent.
+ enabled: !!root.acceptDropFunc
+
OpacityAnimator {
from: 0.0 // QTBUG-66475
to: 1.0
@@ -340,6 +345,11 @@ ListView {
// issue. See QTBUG-131106, QTBUG-89158, ...
moveDisplaced: Transition {
+ // Transition is relevant when drag and drop is feasible.
+ // Component approach can not be used here because `Transition`
+ // does not have a "target" property, and wants a valid parent.
+ enabled: !!root.acceptDropFunc
+
NumberAnimation {
// TODO: Use YAnimator >= Qt 6.0 (QTBUG-66475)
property: (root.orientation === ListView.Vertical) ? "y" : "x"
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6c6b68d8c8637f2d181ab2b4da8b527dce979181
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6c6b68d8c8637f2d181ab2b4da8b527dce979181
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