[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: fix visual focus when returning to a grid view
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Fri Nov 6 14:07:40 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
c3b9835e by Leon Vitanos at 2026-11-06T14:37:19+01:00
qml: fix visual focus when returning to a grid view
- - - - -
10c3bf86 by Leon Vitanos at 2026-11-06T14:37:19+01:00
qml: fix BrowseHomeDisplay initial focus in table view
flickable stole initial focus from table view, but without it wasn't possible to navigate to the grid view
- - - - -
adfd616d by Leon Vitanos at 2026-11-06T14:37:19+01:00
qml: fix initial focus in grid view
incoming focus stopped at the grid and its reason never reached the current item
- - - - -
2faf5039 by Leon Vitanos at 2026-11-06T14:37:19+01:00
qml: remove obsolete initial selection and resetFocus on activeFocusChanged
this should not be done per view
- - - - -
9 changed files:
- modules/gui/qt/medialibrary/qml/MusicAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicGenres.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/medialibrary/qml/VideoGridDisplay.qml
- modules/gui/qt/network/qml/BrowseDeviceView.qml
- modules/gui/qt/network/qml/BrowseHomeDisplay.qml
- modules/gui/qt/network/qml/BrowseTreeDisplay.qml
- modules/gui/qt/widgets/qml/ExpandGridView.qml
Changes:
=====================================
modules/gui/qt/medialibrary/qml/MusicAlbums.qml
=====================================
@@ -104,6 +104,8 @@ MainViewLoader {
basePictureWidth: VLCStyle.gridCover_music_width
basePictureHeight: VLCStyle.gridCover_music_height
+ focus: true
+
activeFocusOnTab:true
headerDelegate: root.header
=====================================
modules/gui/qt/medialibrary/qml/MusicGenres.qml
=====================================
@@ -97,22 +97,6 @@ MainViewLoader {
indexesFlat: !!selectionModel.selectedIndexesFlat
}
- /*
- *define the initial position/selection
- * This is done on activeFocus rather than Component.onCompleted because selectionModel.
- * selectedGroup update itself after this event
- */
- onActiveFocusChanged: {
- if (activeFocus && genreModel.count > 0 && !selectionModel.hasSelection) {
- let initialIndex = 0
- if (currentIndex !== -1)
- initialIndex = currentIndex
-
- selectionModel.select(genreModel.index(initialIndex, 0), ItemSelectionModel.ClearAndSelect)
- currentItem.currentIndex = initialIndex
- }
- }
-
MLContextMenu {
id: contextMenu
=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
=====================================
@@ -80,16 +80,6 @@ MainViewLoader {
// Events
//---------------------------------------------------------------------------------------------
- // NOTE: Define the initial position and selection. This is done on activeFocus rather than
- // Component.onCompleted because selectionModel.selectedGroup update itself after this
- // event.
- onActiveFocusChanged: {
- if (activeFocus == false || model.count === 0 || selectionModel.hasSelection)
- return;
-
- resetFocus()
- }
-
Component.onCompleted: {
root.Keys.deletePressed.connect(root.deleteSelectedPlaylists)
}
@@ -287,6 +277,8 @@ MainViewLoader {
//-------------------------------------------------------------------------------------
// Settings
+ focus: true
+
basePictureWidth: isMusic ? VLCStyle.gridCover_music_width : VLCStyle.gridCover_video_width
basePictureHeight: isMusic ? VLCStyle.gridCover_music_height : VLCStyle.gridCover_video_height
@@ -382,16 +374,6 @@ MainViewLoader {
//-------------------------------------------------------------------------------------
// Events
- // NOTE: Define the initial position and selection. This is done on activeFocus rather
- // than Component.onCompleted because selectionModel.selectedGroup update itself
- // after this event.
- onActiveFocusChanged: {
- if (activeFocus == false || model.count === 0 || selectionModel.hasSelection)
- return;
-
- selectionModel.select(model.index(0,0), ItemSelectionModel.ClearAndSelect)
- }
-
onActionAtIndex: _actionAtIndex()
//-------------------------------------------------------------------------------------
=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -148,6 +148,8 @@ MainViewLoader {
// Settings
+ focus: true
+
model: root.model
selectionModel: root.selectionModel
=====================================
modules/gui/qt/medialibrary/qml/VideoGridDisplay.qml
=====================================
@@ -54,18 +54,6 @@ Widgets.ExpandGridItemView {
return true
}
- // Events
-
- // NOTE: Define the initial position and selection. This is done on activeFocus rather
- // than Component.onCompleted because selectionModel.selectedGroup update itself
- // after this event.
- onActiveFocusChanged: {
- if (!activeFocus || model.count === 0 || selectionModel.hasSelection)
- return;
-
- resetFocus() // restores initialIndex
- }
-
// Connections
Connections {
=====================================
modules/gui/qt/network/qml/BrowseDeviceView.qml
=====================================
@@ -174,6 +174,8 @@ FocusScope {
Widgets.ExpandGridItemView {
id: gridView
+ focus: true
+
basePictureWidth: VLCStyle.gridCover_network_width
basePictureHeight: VLCStyle.gridCover_network_height
=====================================
modules/gui/qt/network/qml/BrowseHomeDisplay.qml
=====================================
@@ -133,8 +133,6 @@ Widgets.PageExt {
flickableDirection: Flickable.AutoFlickIfNeeded
boundsBehavior: Flickable.StopAtBounds
- focus: true
-
pixelAligned: (MainCtx.qtVersion() >= MainCtx.qtVersionCheck(6, 2, 5)) // QTBUG-103996
&& (Screen.pixelDensity >= VLCStyle.highPixelDensityThreshold) // no need for sub-pixel alignment with high pixel density
=====================================
modules/gui/qt/network/qml/BrowseTreeDisplay.qml
=====================================
@@ -152,6 +152,8 @@ Widgets.PageExt {
Widgets.ExpandGridItemView {
id: gridView
+ focus: true
+
basePictureWidth: VLCStyle.gridCover_network_width
basePictureHeight: VLCStyle.gridCover_network_height
subtitleHeight: 0
=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -753,7 +753,7 @@ FocusScope {
if (activeFocus && currentIndex === item.index && expandIndex === -1)
item.forceActiveFocus(_currentFocusReason)
else
- item.focus = false
+ item.focus = (!activeFocus && currentIndex === item.index && expandIndex === -1)
}
function _refreshData( iMin, iMax ) {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e31609fda86d2104716b03f6c43cf3c4306b8c4d...2faf503918df22f1da609bacf66c5f55f9a3db35
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e31609fda86d2104716b03f6c43cf3c4306b8c4d...2faf503918df22f1da609bacf66c5f55f9a3db35
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list