[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: move track selection column as component

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Nov 5 13:11:18 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2572b9ec by Pierre Lamot at 2025-11-05T12:55:14+00:00
qml: move track selection column as component

this remove the need of js dictionnary + delegate and aligns with other uses
with of NavigableRow

- - - - -
0a43e1d0 by Pierre Lamot at 2025-11-05T12:55:14+00:00
qml: make NavigableRow/Col containers

This way we can directly pass the widgets as children of the container rather
than using an ObjectModel

- - - - -


8 changed files:

- modules/gui/qt/maininterface/qml/BannerSources.qml
- modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
- modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
- modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
- modules/gui/qt/player/qml/Player.qml
- modules/gui/qt/player/qml/TracksListPage.qml
- modules/gui/qt/widgets/qml/NavigableCol.qml
- modules/gui/qt/widgets/qml/NavigableRow.qml


Changes:

=====================================
modules/gui/qt/maininterface/qml/BannerSources.qml
=====================================
@@ -88,7 +88,7 @@ T.ToolBar {
     contentItem:  Column {
         id: pLBannerSources
 
-        property alias model: globalMenuGroup.model
+        property alias model: globalMenuRepeater.model
 
             anchors {
                 fill: parent
@@ -103,7 +103,7 @@ T.ToolBar {
                 anchors.rightMargin: VLCStyle.applicationHorizontalMargin
 
                 property bool colapseTabButtons: globalToolbar.width  > (Math.max(globalToolbarLeft.width, globalToolbarRight.width) + VLCStyle.applicationHorizontalMargin)* 2
-                                                 + globalMenuGroup.model.count * VLCStyle.bannerTabButton_width_large
+                                                 + globalMenuRepeater.model.count * VLCStyle.bannerTabButton_width_large
 
                 //drag and dbl click the titlebar in CSD mode
                 Loader {
@@ -183,12 +183,17 @@ T.ToolBar {
                             Navigation.leftItem: history_back
                             Navigation.downItem: localMenuView.visible ?  localMenuView : localToolbar
 
-                            delegate: Widgets.BannerTabButton {
-                                iconTxt: model.icon
-                                showText: globalToolbar.colapseTabButtons
-                                selected: History.match(History.viewPath, ["mc", model.name])
-                                onClicked: root.itemClicked(model.index)
-                                height: globalMenuGroup.height
+                            Repeater {
+                                id: globalMenuRepeater
+
+                                delegate: Widgets.BannerTabButton {
+
+                                    iconTxt: model.icon
+                                    showText: globalToolbar.colapseTabButtons
+                                    selected: History.match(History.viewPath, ["mc", model.name])
+                                    onClicked: root.itemClicked(model.index)
+                                    height: globalMenuGroup.height
+                                }
                             }
                         }
                     }
@@ -255,43 +260,41 @@ T.ToolBar {
                             }
                         }
 
-                        model: ObjectModel {
-                            Widgets.IconToolButton {
-                                id: list_grid_btn
-
-                                visible: MainCtx.hasGridListMode
-                                width: VLCStyle.bannerButton_width
-                                height: VLCStyle.bannerButton_height
-                                font.pixelSize: VLCStyle.icon_banner
-                                text: MainCtx.gridView ? VLCIcons.list : VLCIcons.grid
-                                description: qsTr("List/Grid")
-                                onClicked: MainCtx.gridView = !MainCtx.gridView
-                                enabled: true
-                            }
+                        Widgets.IconToolButton {
+                            id: list_grid_btn
+
+                            visible: MainCtx.hasGridListMode
+                            width: VLCStyle.bannerButton_width
+                            height: VLCStyle.bannerButton_height
+                            font.pixelSize: VLCStyle.icon_banner
+                            text: MainCtx.gridView ? VLCIcons.list : VLCIcons.grid
+                            description: qsTr("List/Grid")
+                            onClicked: MainCtx.gridView = !MainCtx.gridView
+                            enabled: true
+                        }
 
-                            Widgets.SortControl {
-                                id: sortControl
+                        Widgets.SortControl {
+                            id: sortControl
 
-                                width: VLCStyle.bannerButton_width
-                                height: VLCStyle.bannerButton_height
+                            width: VLCStyle.bannerButton_width
+                            height: VLCStyle.bannerButton_height
 
-                                font.pixelSize: VLCStyle.icon_banner
+                            font.pixelSize: VLCStyle.icon_banner
 
-                                visible: MainCtx.sort.available
+                            visible: MainCtx.sort.available
 
-                                enabled: visible
+                            enabled: visible
 
-                                model: MainCtx.sort.model
+                            model: MainCtx.sort.model
 
-                                sortKey:  MainCtx.sort.criteria
-                                sortOrder: MainCtx.sort.order
+                            sortKey:  MainCtx.sort.criteria
+                            sortOrder: MainCtx.sort.order
 
-                                onSortSelected: (key) => {
-                                    MainCtx.sort.criteria = key
-                                }
-                                onSortOrderSelected: (type) => {
-                                    MainCtx.sort.order = type
-                                }
+                            onSortSelected: (key) => {
+                                MainCtx.sort.criteria = key
+                            }
+                            onSortOrderSelected: (type) => {
+                                MainCtx.sort.order = type
                             }
                         }
 
@@ -385,101 +388,99 @@ T.ToolBar {
                         }
                         spacing: VLCStyle.margin_normal
 
-                        model: ObjectModel {
-
-                            Widgets.SearchBox {
-                                id: searchBox
+                        Widgets.SearchBox {
+                            id: searchBox
 
-                                // set max width so that search field not overflows with small screens
-                                // assumes all other sibling is a button of 'VLCStyle.bannerButton_width' width
-                                maxSearchFieldWidth: root.width
-                                                     - (VLCStyle.bannerButton_width * playlistGroup.count)
-                                                     - (playlistGroup.spacing * (playlistGroup.count - 1))
-                                                     - playlistGroup.anchors.rightMargin
-                                                     - VLCStyle.margin_small // padding to left
+                            // set max width so that search field not overflows with small screens
+                            // assumes all other sibling is a button of 'VLCStyle.bannerButton_width' width
+                            maxSearchFieldWidth: root.width
+                                                 - (VLCStyle.bannerButton_width * playlistGroup.count)
+                                                 - (playlistGroup.spacing * (playlistGroup.count - 1))
+                                                 - playlistGroup.anchors.rightMargin
+                                                 - VLCStyle.margin_small // padding to left
 
-                                visible: MainCtx.search.available
-                                height: VLCStyle.bannerButton_height
-                                buttonWidth: VLCStyle.bannerButton_width
-                            }
+                            visible: MainCtx.search.available
+                            height: VLCStyle.bannerButton_height
+                            buttonWidth: VLCStyle.bannerButton_width
+                        }
 
-                            Widgets.IconToolButton {
-                                id: playlist_btn
+                        Widgets.IconToolButton {
+                            id: playlist_btn
 
-                                checked: MainCtx.playlistVisible
+                            checked: MainCtx.playlistVisible
 
-                                font.pixelSize: VLCStyle.icon_banner
-                                text: VLCIcons.playlist
-                                description: qsTr("Playlist")
-                                width: VLCStyle.bannerButton_width
-                                height: VLCStyle.bannerButton_height
-                                highlighted: MainCtx.playlistVisible
+                            font.pixelSize: VLCStyle.icon_banner
+                            text: VLCIcons.playlist
+                            description: qsTr("Playlist")
+                            width: VLCStyle.bannerButton_width
+                            height: VLCStyle.bannerButton_height
+                            highlighted: MainCtx.playlistVisible
 
-                                onClicked:  MainCtx.playlistVisible = !MainCtx.playlistVisible
+                            onClicked:  MainCtx.playlistVisible = !MainCtx.playlistVisible
 
-                                DropArea {
-                                    anchors.fill: parent
+                            DropArea {
+                                anchors.fill: parent
 
-                                    onContainsDragChanged: {
-                                        if (containsDrag)
-                                            _timer.restart()
-                                        else
-                                            _timer.stop()
-                                    }
+                                onContainsDragChanged: {
+                                    if (containsDrag)
+                                        _timer.restart()
+                                    else
+                                        _timer.stop()
+                                }
 
-                                    onEntered: (drag) => {
-                                        if (root.playlistPane) {
-                                            console.assert(root.playlistPane.isDropAcceptableFunc)
-                                            console.assert(root.playlistPane.model)
-                                            if (root.playlistPane.isDropAcceptableFunc(drag, root.playlistPane.model.count)) {
-                                                drag.accept()
-                                            } else {
-                                                drag.accepted = false
-                                            }
+                                onEntered: (drag) => {
+                                    if (root.playlistPane) {
+                                        console.assert(root.playlistPane.isDropAcceptableFunc)
+                                        console.assert(root.playlistPane.model)
+                                        if (root.playlistPane.isDropAcceptableFunc(drag, root.playlistPane.model.count)) {
+                                            drag.accept()
                                         } else {
                                             drag.accepted = false
                                         }
+                                    } else {
+                                        drag.accepted = false
                                     }
+                                }
 
-                                    onDropped: (drop) => {
-                                        if (root.playlistPane) {
-                                            console.assert(root.playlistPane.acceptDropFunc)
-                                            root.playlistPane.acceptDropFunc(root.playlistPane.model.count, drop)
-                                        }
+                                onDropped: (drop) => {
+                                    if (root.playlistPane) {
+                                        console.assert(root.playlistPane.acceptDropFunc)
+                                        root.playlistPane.acceptDropFunc(root.playlistPane.model.count, drop)
                                     }
+                                }
 
-                                    Timer {
-                                        id: _timer
-                                        interval: VLCStyle.duration_humanMoment
+                                Timer {
+                                    id: _timer
+                                    interval: VLCStyle.duration_humanMoment
 
-                                        onTriggered: {
-                                            MainCtx.playlistVisible = true
-                                        }
+                                    onTriggered: {
+                                        MainCtx.playlistVisible = true
                                     }
                                 }
                             }
+                        }
 
-                            Widgets.IconToolButton {
-                                id: menu_selector
-
-                                visible: !MainCtx.hasToolbarMenu
-                                font.pixelSize: VLCStyle.icon_banner
-                                text: VLCIcons.more
-                                description: qsTr("Menu")
-                                width: VLCStyle.bannerButton_width
-                                height: VLCStyle.bannerButton_height
-                                checked: contextMenu.shown
-
-                                onClicked: contextMenu.popup(this.mapToGlobal(0, height))
-
-                                Menus.QmlGlobalMenu {
-                                    id: contextMenu
-                                    ctx: MainCtx
-                                    playerViewVisible: History.match(History.viewPath, ["player"])
-                                }
+                        Widgets.IconToolButton {
+                            id: menu_selector
+
+                            visible: !MainCtx.hasToolbarMenu
+                            font.pixelSize: VLCStyle.icon_banner
+                            text: VLCIcons.more
+                            description: qsTr("Menu")
+                            width: VLCStyle.bannerButton_width
+                            height: VLCStyle.bannerButton_height
+                            checked: contextMenu.shown
+
+                            onClicked: contextMenu.popup(this.mapToGlobal(0, height))
+
+                            Menus.QmlGlobalMenu {
+                                id: contextMenu
+                                ctx: MainCtx
+                                playerViewVisible: History.match(History.viewPath, ["player"])
                             }
                         }
 
+
                         Navigation.parentItem: root
                         Navigation.leftItem: localMenuView
                         Navigation.upItem: globalMenuGroup


=====================================
modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
=====================================
@@ -207,30 +207,30 @@ FocusScope {
                 Layout.fillWidth: true
                 Layout.topMargin: VLCStyle.margin_large
 
-                model: ObjectModel {
-                    Widgets.ActionButtonPrimary {
-                        id: playActionBtn
-                        iconTxt: VLCIcons.play
-                        text: qsTr("Play all")
-                        focus: true
 
-                        //we probably want to keep this button like the other action buttons
-                        colorContext.palette: VLCStyle.palette
+                Widgets.ActionButtonPrimary {
+                    id: playActionBtn
+                    iconTxt: VLCIcons.play
+                    text: qsTr("Play all")
+                    focus: true
 
-                        showText: actionButtons.width > VLCStyle.colWidth(2)
+                    //we probably want to keep this button like the other action buttons
+                    colorContext.palette: VLCStyle.palette
 
-                        onClicked: MediaLib.addAndPlay( artist.id )
-                    }
+                    showText: actionButtons.width > VLCStyle.colWidth(2)
 
-                    Widgets.ActionButtonOverlay {
-                        id: enqueueActionBtn
-                        iconTxt: VLCIcons.enqueue
-                        text: qsTr("Enqueue all")
-                        onClicked: MediaLib.addToPlaylist( artist.id )
+                    onClicked: MediaLib.addAndPlay( artist.id )
+                }
+
+                Widgets.ActionButtonOverlay {
+                    id: enqueueActionBtn
+                    iconTxt: VLCIcons.enqueue
+                    text: qsTr("Enqueue all")
+                    onClicked: MediaLib.addToPlaylist( artist.id )
 
-                        showText: actionButtons.width > VLCStyle.colWidth(2)
-                    }
+                    showText: actionButtons.width > VLCStyle.colWidth(2)
                 }
+
             }
 
             Item {


=====================================
modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
=====================================
@@ -154,34 +154,33 @@ FocusScope {
 
                 Layout.alignment: Qt.AlignCenter
 
-                model: ObjectModel {
-                    Widgets.ActionButtonPrimary {
-                        id: _playActionBtn
-
-                        iconTxt: VLCIcons.play
-                        text: qsTr("Play")
-                        onClicked: MediaLib.addAndPlay( root.model.id )
-
-                        onActiveFocusChanged: {
-                            // root.setCurrentItemFocus sets active focus to playActionBtn, but it gets stolen
-                            // by the delegate of the first track at initial load when playActionBtn is in the
-                            // header of tracks
-                            if (VLCStyle.isScreenSmall && root.forcePlayActionBtnFocusOnce) {
-                                root.forcePlayActionBtnFocusOnce = false
-                                root.playActionBtn.forceActiveFocus(Qt.TabFocusReason)
-                            }
+                Widgets.ActionButtonPrimary {
+                    id: _playActionBtn
+
+                    iconTxt: VLCIcons.play
+                    text: qsTr("Play")
+                    onClicked: MediaLib.addAndPlay( root.model.id )
+
+                    onActiveFocusChanged: {
+                        // root.setCurrentItemFocus sets active focus to playActionBtn, but it gets stolen
+                        // by the delegate of the first track at initial load when playActionBtn is in the
+                        // header of tracks
+                        if (VLCStyle.isScreenSmall && root.forcePlayActionBtnFocusOnce) {
+                            root.forcePlayActionBtnFocusOnce = false
+                            root.playActionBtn.forceActiveFocus(Qt.TabFocusReason)
                         }
                     }
+                }
 
-                    Widgets.ButtonExt {
-                        id: _enqueueActionBtn
+                Widgets.ButtonExt {
+                    id: _enqueueActionBtn
 
-                        iconTxt: VLCIcons.enqueue
-                        text: qsTr("Enqueue")
-                        onClicked: MediaLib.addToPlaylist( root.model.id )
-                    }
+                    iconTxt: VLCIcons.enqueue
+                    text: qsTr("Enqueue")
+                    onClicked: MediaLib.addToPlaylist( root.model.id )
                 }
 
+
                 Navigation.parentItem: root
                 Navigation.rightItem: VLCStyle.isScreenSmall ? root.headerFocusScope : tracks
                 Navigation.upItem: VLCStyle.isScreenSmall ? root.headerFocusScope : null


=====================================
modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
=====================================
@@ -131,22 +131,20 @@ FocusScope {
                         focus: true
                         spacing: VLCStyle.margin_large
 
-                        model: ObjectModel {
-                            Widgets.ActionButtonPrimary {
-                                id: playActionBtn
+                        Widgets.ActionButtonPrimary {
+                            id: playActionBtn
 
-                                iconTxt: VLCIcons.play
-                                text: qsTr("Play")
-                                onClicked: MediaLib.addAndPlay( model.id )
-                            }
+                            iconTxt: VLCIcons.play
+                            text: qsTr("Play")
+                            onClicked: MediaLib.addAndPlay( model.id )
+                        }
 
-                            Widgets.ButtonExt {
-                                id: enqueueActionBtn
+                        Widgets.ButtonExt {
+                            id: enqueueActionBtn
 
-                                iconTxt: VLCIcons.enqueue
-                                text: qsTr("Enqueue")
-                                onClicked: MediaLib.addToPlaylist( model.id )
-                            }
+                            iconTxt: VLCIcons.enqueue
+                            text: qsTr("Enqueue")
+                            onClicked: MediaLib.addToPlaylist( model.id )
                         }
 
                         Navigation.parentItem: root


=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -541,27 +541,25 @@ FocusScope {
                                 componentCompleted = true
                             }
 
-                            model: ObjectModel {
-                                Widgets.IconToolButton {
-                                    text: VLCIcons.skip_back
-                                    font.pixelSize: VLCStyle.icon_audioPlayerButton
-                                    onClicked: Player.jumpBwd()
-                                    description: qsTr("Step back")
-                                }
+                            Widgets.IconToolButton {
+                                text: VLCIcons.skip_back
+                                font.pixelSize: VLCStyle.icon_audioPlayerButton
+                                onClicked: Player.jumpBwd()
+                                description: qsTr("Step back")
+                            }
 
-                                Widgets.IconToolButton {
-                                    text: VLCIcons.visualization
-                                    font.pixelSize: VLCStyle.icon_audioPlayerButton
-                                    onClicked: Player.toggleVisualization()
-                                    description: qsTr("Visualization")
-                                }
+                            Widgets.IconToolButton {
+                                text: VLCIcons.visualization
+                                font.pixelSize: VLCStyle.icon_audioPlayerButton
+                                onClicked: Player.toggleVisualization()
+                                description: qsTr("Visualization")
+                            }
 
-                                Widgets.IconToolButton{
-                                    text: VLCIcons.skip_for
-                                    font.pixelSize: VLCStyle.icon_audioPlayerButton
-                                    onClicked: Player.jumpFwd()
-                                    description: qsTr("Step forward")
-                                }
+                            Widgets.IconToolButton{
+                                text: VLCIcons.skip_for
+                                font.pixelSize: VLCStyle.icon_audioPlayerButton
+                                onClicked: Player.jumpFwd()
+                                description: qsTr("Step forward")
                             }
                         }
                     }


=====================================
modules/gui/qt/player/qml/TracksListPage.qml
=====================================
@@ -76,175 +76,175 @@ RowLayout {
 
         Navigation.leftItem: playbackBtn
 
-        //we store the model in a different property as functions can't be passed in modelData
-        property var modelDefinition: [{
-                "title": qsTr("Subtitle"),
-                "tracksModel": Player.subtitleTracks,
-                "menuIcon": VLCIcons.expand,
-                "menuText": qsTr("Menu"),
-                "menuAction": function(menuPos) {
-                    menuSubtitle.popup(menuPos)
-                },
-
-            }, {
-                "title": qsTr("Audio"),
-                "tracksModel": Player.audioTracks,
-                "menuIcon": VLCIcons.expand,
-                "menuText": qsTr("Menu"),
-                "menuAction": function(menuPos) {
-                    menuAudio.popup(menuPos)
-                }
-            }, {
-                "title": qsTr("Video Tracks"),
-                "tracksModel": Player.videoTracks,
-                "menuIcon": VLCIcons.add,
-                "menuText": qsTr("Add"),
-                "menuAction": function(menuPos) {
-                    DialogsProvider.loadVideoFile()
-                },
-            }]
+        TrackColumn {
+            title: qsTr("Subtitle")
+            tracksModel: Player.subtitleTracks
+            menuIcon: VLCIcons.expand
+            menuText: qsTr("Menu")
+            onMenuAction: (menuPos)  => {
+                menuSubtitle.popup(menuPos)
+            }
+        }
 
-        //note that parenthesis around functions are *mandatory*
-        model: modelDefinition
+        TrackColumn {
+            title: qsTr("Audio")
+            tracksModel: Player.audioTracks
+            menuIcon: VLCIcons.expand
+            menuText: qsTr("Menu")
+            onMenuAction: (menuPos)  => {
+                menuAudio.popup(menuPos)
+            }
+        }
 
-        delegate: Container {
-            // wrap the contentItem i.e Column into Container
-            // so that we can get focusReason, also Container
-            // is a FocusScope
+        TrackColumn {
+            title: qsTr("Video Tracks")
+            tracksModel: Player.videoTracks
+            menuIcon: VLCIcons.add
+            menuText: qsTr("Add")
+            onMenuAction: (menuPos) => {
+                DialogsProvider.loadVideoFile()
+            }
+        }
+    }
 
-            id: tracksListContainer
+    component TrackColumn: Container {
+        // wrap the contentItem i.e Column into Container
+        // so that we can get focusReason, also Container
+        // is a FocusScope
+        id: tracksListContainer
 
-            required property var modelData
-            required property int index
 
-            property var tracksModel: modelData.tracksModel
+        required property string title
+        required property var tracksModel
+        required property string menuIcon
+        required property string menuText
 
-            focus: true
+        signal menuAction(point position)
 
-            width: row.width / 3
-            height: row.height
+        focus: true
 
-            onActiveFocusChanged: if (activeFocus) tracksList.forceActiveFocus(focusReason)
+        width: row.width / 3
+        height: row.height
 
-            // this is required to initialize attached Navigation property
-            Navigation.parentItem: row
+        onActiveFocusChanged: if (activeFocus) tracksList.forceActiveFocus(focusReason)
 
-            contentItem: Column {
-                anchors.fill: parent
+        // this is required to initialize attached Navigation property
+        Navigation.parentItem: row
 
-                focus: true
+        contentItem: Column {
+            anchors.fill: parent
 
-                Accessible.role: Accessible.Pane
-                Accessible.name: modelData.title
+            focus: true
 
-                Item {
-                    // keep it inside so "Column" doesn't mess with it
-                   Rectangle {
-                       id: separator
+            Accessible.role: Accessible.Pane
+            Accessible.name: tracksListContainer.title
 
-                       x: 0
-                       y: 0
-                       width: VLCStyle.margin_xxxsmall
+            Item {
+                // keep it inside so "Column" doesn't mess with it
+               Rectangle {
+                   id: separator
 
-                       height: tracksListContainer.height
-                       color: theme.border
-                   }
-                }
+                   x: 0
+                   y: 0
+                   width: VLCStyle.margin_xxxsmall
 
-                Row {
-                    id: titleHeader
+                   height: tracksListContainer.height
+                   color: theme.border
+               }
+            }
 
-                    width: tracksListContainer.width
-                    height: implicitHeight
+            Row {
+                id: titleHeader
 
-                    padding: VLCStyle.margin_xsmall
+                width: tracksListContainer.width
+                height: implicitHeight
 
-                    topPadding: VLCStyle.margin_large
-                    leftPadding: VLCStyle.margin_xxlarge + separator.width
+                padding: VLCStyle.margin_xsmall
 
-                    focus: true
+                topPadding: VLCStyle.margin_large
+                leftPadding: VLCStyle.margin_xxlarge + separator.width
 
-                    clip: true
+                focus: true
 
-                    Widgets.SubtitleLabel {
-                        id: titleText
+                clip: true
 
-                        width: parent.width - button.width - parent.leftPadding
-                               - parent.rightPadding
+                Widgets.SubtitleLabel {
+                    id: titleText
 
-                        text: modelData.title
-                        color: theme.fg.primary
-                    }
+                    width: parent.width - button.width - parent.leftPadding
+                           - parent.rightPadding
 
-                    Widgets.IconTrackButton {
-                        id: button
+                    text: tracksListContainer.title
+                    color: theme.fg.primary
+                }
+
+                Widgets.IconTrackButton {
+                    id: button
 
-                        font.pixelSize: VLCStyle.icon_track
+                    font.pixelSize: VLCStyle.icon_track
 
-                        focus: true
+                    focus: true
 
-                        description: modelData.menuText
-                        text: modelData.menuIcon
+                    description: tracksListContainer.menuText
+                    text: tracksListContainer.menuIcon
 
-                        Navigation.parentItem: tracksListContainer
-                        Navigation.downItem: tracksList
+                    Navigation.parentItem: tracksListContainer
+                    Navigation.downItem: tracksList
 
-                        onClicked: {
-                            //functions aren't passed to modelData
-                            row.modelDefinition[index].menuAction(mapToGlobal(0, height))
-                        }
+                    onClicked: {
+                        tracksListContainer.menuAction(mapToGlobal(0, height))
                     }
                 }
+            }
 
-                Widgets.ListViewExt {
-                    id: tracksList
+            Widgets.ListViewExt {
+                id: tracksList
 
-                    model: tracksListContainer.tracksModel
-                    width: tracksListContainer.width
-                    height: tracksListContainer.height - titleHeader.height
-                    leftMargin: separator.width
-                    focus: true
+                model: tracksListContainer.tracksModel
+                width: tracksListContainer.width
+                height: tracksListContainer.height - titleHeader.height
+                leftMargin: separator.width
+                focus: true
+                clip: true
+
+                fadingEdge.backgroundColor: theme.bg.primary
+
+                Accessible.role: Accessible.List
+                Accessible.name: qsTr("Track list")
+
+                Navigation.parentItem: tracksListContainer
+                Navigation.upItem: button
+                Keys.priority: Keys.AfterItem
+                Keys.onPressed: (event) => Navigation.defaultKeyAction(event)
+
+                delegate: Widgets.CheckedDelegate {
+                    readonly property bool isModelChecked: model.checked
                     clip: true
 
-                    fadingEdge.backgroundColor: theme.bg.primary
+                    focus: true
+                    text: model.display
+                    width: tracksListContainer.width - VLCStyle.margin_xxxsmall
+                    height: VLCStyle.dp(40, VLCStyle.scale)
+                    opacity: hovered || activeFocus || checked ? 1 : .6
+                    font.weight: hovered
+                                 || activeFocus ? Font.DemiBold : Font.Normal
+
+                    onIsModelCheckedChanged: {
+                        if (model.checked !== checked)
+                            checked = model.checked
+                    }
 
-                    Accessible.role: Accessible.List
-                    Accessible.name: qsTr("Track list")
+                    onCheckedChanged: {
+                        if (model.checked !== checked)
+                            model.checked = checked
+                    }
 
-                    Navigation.parentItem: tracksListContainer
-                    Navigation.upItem: button
-                    Keys.priority: Keys.AfterItem
-                    Keys.onPressed: (event) => Navigation.defaultKeyAction(event)
-
-                    delegate: Widgets.CheckedDelegate {
-                        readonly property bool isModelChecked: model.checked
-                        clip: true
-
-                        focus: true
-                        text: model.display
-                        width: tracksListContainer.width - VLCStyle.margin_xxxsmall
-                        height: VLCStyle.dp(40, VLCStyle.scale)
-                        opacity: hovered || activeFocus || checked ? 1 : .6
-                        font.weight: hovered
-                                     || activeFocus ? Font.DemiBold : Font.Normal
-
-                        onIsModelCheckedChanged: {
-                            if (model.checked !== checked)
-                                checked = model.checked
-                        }
-
-                        onCheckedChanged: {
-                            if (model.checked !== checked)
-                                model.checked = checked
-                        }
-
-                        onClicked: {
-                            tracksList.currentIndex = index
-                            tracksList.setCurrentItemFocus(Qt.MouseFocusReason)
-                        }
-
-                        Navigation.parentItem: tracksList
+                    onClicked: {
+                        tracksList.currentIndex = index
+                        tracksList.setCurrentItemFocus(Qt.MouseFocusReason)
                     }
+
+                    Navigation.parentItem: tracksList
                 }
             }
         }


=====================================
modules/gui/qt/widgets/qml/NavigableCol.qml
=====================================
@@ -22,7 +22,7 @@ import QtQuick.Templates as T
 import VLC.MainInterface
 import VLC.Util
 
-T.Control {
+T.Container {
     id: root
 
     // Properties
@@ -31,16 +31,6 @@ T.Control {
 
     property int _countEnabled: 0
 
-    // Aliases
-
-    property alias model: repeater.model
-    property alias delegate: repeater.delegate
-
-    property alias count: repeater.count
-
-    function itemAt(index) {
-        return repeater.itemAt(index)
-    }
 
     implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
                             implicitContentWidth + leftPadding + rightPadding)
@@ -147,6 +137,8 @@ T.Control {
         Repeater{
             id: repeater
 
+            model: root.contentModel
+
             onItemAdded: (index, item) => {
                 if (item.enabled) root._countEnabled += 1;
 


=====================================
modules/gui/qt/widgets/qml/NavigableRow.qml
=====================================
@@ -22,7 +22,7 @@ import QtQuick.Templates as T
 import VLC.MainInterface
 import VLC.Util
 
-T.Control {
+T.Container  {
     id: root
 
     // Properties
@@ -33,9 +33,6 @@ T.Control {
 
     // Aliases
 
-    property alias count: repeater.count
-
-    property alias model: repeater.model
     property alias delegate: repeater.delegate
 
     // Settings
@@ -141,6 +138,8 @@ T.Control {
         Repeater{
             id: repeater
 
+            model: root.contentModel
+
             onItemAdded: (index, item) => {
                 if (item.enabled) root._countEnabled += 1;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/017e5bcd6a4574ebb7388df9ac8efbe13fab6c68...0a43e1d0ab91a5bf2da576d96a6e2e3916aea7d7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/017e5bcd6a4574ebb7388df9ac8efbe13fab6c68...0a43e1d0ab91a5bf2da576d96a6e2e3916aea7d7
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