diff --git a/modules/gui/qt/medialibrary/qml/MusicAlbums.qml b/modules/gui/qt/medialibrary/qml/MusicAlbums.qml index 8779ba9a050c1d7fe85f159949053985e8f9c9bf..a6f6785414a6d42d2e887a12a3e9942e39954847 100644 --- a/modules/gui/qt/medialibrary/qml/MusicAlbums.qml +++ b/modules/gui/qt/medialibrary/qml/MusicAlbums.qml @@ -110,7 +110,7 @@ Widgets.NavigableFocusScope { } onCountChanged: { - if (delegateModelId.items.count > 0 && delegateModelId.selectedGroup.count === 0) { + if (delegateModelId.items.count > 0 && !delegateModelId.hasSelection) { root.resetFocus() } } diff --git a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml index d4e35e428629b13f5432b96fcbeff55d144b24c7..e6164c6e2086cefbde410324932a011d7faeb655 100644 --- a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml +++ b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml @@ -68,7 +68,7 @@ Widgets.NavigableFocusScope { } onCountChanged: { - if (delegateModel.items.count > 0 && delegateModel.selectedGroup.count === 0) { + if (delegateModel.items.count > 0 && !delegateModel.hasSelection) { var initialIndex = root.initialIndex if (initialIndex >= delegateModel.items.count) initialIndex = 0 diff --git a/modules/gui/qt/medialibrary/qml/MusicGenres.qml b/modules/gui/qt/medialibrary/qml/MusicGenres.qml index 3722616dfd655dd75112e27e5191c4e037434416..49f0bd493baea258197ab8b8a9069e2db24bcb46 100644 --- a/modules/gui/qt/medialibrary/qml/MusicGenres.qml +++ b/modules/gui/qt/medialibrary/qml/MusicGenres.qml @@ -126,7 +126,7 @@ Widgets.NavigableFocusScope { } onCountChanged: { - if (delegateModelId.items.count > 0 && delegateModelId.selectedGroup.count === 0) { + if (delegateModelId.items.count > 0 && !delegateModelId.hasSelection) { root.resetFocus() } } @@ -149,7 +149,7 @@ Widgets.NavigableFocusScope { * selectedGroup update itself after this event */ onActiveFocusChanged: { - if (activeFocus && delegateModelId.items.count > 0 && delegateModelId.selectedGroup.count === 0) { + if (activeFocus && delegateModelId.items.count > 0 && !delegateModelId.hasSelection) { var initialIndex = 0 if (view.currentItem.currentIndex !== -1) initialIndex = view.currentItem.currentIndex diff --git a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml index f9cdd2e77333c264676fd4d7661377f2c0fc7ada..23c370b7ea23bd74bae506d45bc07b16aa9e1bf2 100644 --- a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml +++ b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml @@ -125,7 +125,7 @@ Widgets.NavigableFocusScope { } onCountChanged: { - if (videosDelegate.items.count > 0 && videosDelegate.selectedGroup.count === 0) { + if (videosDelegate.items.count > 0 && !videosDelegate.hasSelection) { root.resetFocus() } } @@ -195,7 +195,7 @@ Widgets.NavigableFocusScope { * selectedGroup update itself after this event */ onActiveFocusChanged: { - if (activeFocus && videosDelegate.items.count > 0 && videosDelegate.selectedGroup.count === 0) { + if (activeFocus && videosDelegate.items.count > 0 && !videosDelegate.hasSelection) { videosDelegate.items.get(0).inSelected = true } } diff --git a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml index 209e270c9df9803aaf61a98316d1b63126899673..305fed3307295c5378ef0438a23bd5a92f8e1b20 100644 --- a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml +++ b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml @@ -45,7 +45,7 @@ Widgets.NavigableFocusScope { } function resetFocus() { - if (delegateModelId.items.count > 0 && delegateModelId.selectedGroup.count === 0) { + if (providerModel.count > 0 && !delegateModelId.hasSelection) { var initialIndex = 0 if (delegateModelId.currentIndex !== -1) initialIndex = delegateModelId.currentIndex diff --git a/modules/gui/qt/util/qml/SelectableDelegateModel.qml b/modules/gui/qt/util/qml/SelectableDelegateModel.qml index 445d278a56c649e4d3a4f6503068a4f020791f50..6a18d396118a8b11ac013f254bf74d496c900496 100644 --- a/modules/gui/qt/util/qml/SelectableDelegateModel.qml +++ b/modules/gui/qt/util/qml/SelectableDelegateModel.qml @@ -23,6 +23,7 @@ DelegateModel { property int shiftIndex: -1 property alias selectedGroup: selectedGroup + readonly property bool hasSelection: selectedGroup.count > 0 groups: [ DelegateModelGroup { id: selectedGroup; name: "selected"; includeByDefault: false } @@ -40,7 +41,7 @@ DelegateModel { } function selectNone() { - if (selectedGroup.count > 0) + if (hasSelection) selectedGroup.remove(0,selectedGroup.count) } diff --git a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml index ad59f7ff8e7fe6f009577f47371484177b59cb50..c96013f71974c451a52f340d6e25133e4a90ab5d 100644 --- a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml +++ b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml @@ -224,7 +224,7 @@ NavigableFocusScope { * selectedGroup update itself after this event */ onActiveFocusChanged: { - if (activeFocus && delegateModel.items.count > 0 && delegateModel.selectedGroup.count === 0) { + if (activeFocus && view.count > 0 && !delegateModel.hasSelection) { var initialIndex = 0 if (view.currentIndex !== -1) initialIndex = view.currentIndex