fix binding loop in getLastFocusableItemInItem (fix #LINQT-2210)

This commit is contained in:
gaelle.braud 2025-11-21 14:01:16 +01:00
parent afd3514965
commit fea9a1b7be
2 changed files with 9 additions and 9 deletions

View file

@ -154,8 +154,8 @@ function isDescendant(child, parent) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Retrieve first focussable item of an Item. If no item found, return undefined // Retrieve first focusable item of an Item. If no item found, return undefined
function getFirstFocussableItemInItem(item) { function getFirstFocusableItemInItem(item) {
var next = item.nextItemInFocusChain(); var next = item.nextItemInFocusChain();
if (next && isDescendant(next, item)){ if (next && isDescendant(next, item)){
return next; return next;
@ -163,8 +163,8 @@ function getFirstFocussableItemInItem(item) {
return undefined; return undefined;
} }
// Retrieve last focussable item of an Item. If no item found, return undefined // Retrieve last focusable item of an Item. If no item found, return undefined
function getLastFocussableItemInItem(item) { function getLastFocusableItemInItem(item) {
var next = item.nextItemInFocusChain(); var next = item.nextItemInFocusChain();
if(next && !isDescendant(next, item)){ if(next && !isDescendant(next, item)){
return undefined; return undefined;
@ -173,7 +173,7 @@ function getLastFocussableItemInItem(item) {
do{ do{
current = next; current = next;
next = current.nextItemInFocusChain(); next = current.nextItemInFocusChain();
} while(isDescendant(next, item) && next.visible) } while(isDescendant(next, item) && next.visible && next !== current)
return current; return current;
} }

View file

@ -38,7 +38,7 @@ AbstractWindow {
== LinphoneEnums.CallState.OutgoingEarlyMedia == LinphoneEnums.CallState.OutgoingEarlyMedia
|| mainWindow.callState == LinphoneEnums.CallState.IncomingReceived || mainWindow.callState == LinphoneEnums.CallState.IncomingReceived
property Item firstButtonInBottomTab : mainWindow.startingCall ? endCallButton : (videoCameraButton.visible && videoCameraButton.enabled ? videoCameraButton : audioMicrophoneButton) property Item firstButtonInBottomTab : mainWindow.startingCall ? endCallButton : (videoCameraButton.visible && videoCameraButton.enabled ? videoCameraButton : audioMicrophoneButton)
property Item lastButtonInBottomTab : mainWindow.startingCall ? Utils.getLastFocussableItemInItem(controlCallButtons) : endCallButton property Item lastButtonInBottomTab : mainWindow.startingCall ? Utils.getLastFocusableItemInItem(controlCallButtons) : endCallButton
onCallStateChanged: { onCallStateChanged: {
if (callState === LinphoneEnums.CallState.Connected) { if (callState === LinphoneEnums.CallState.Connected) {
@ -738,9 +738,9 @@ AbstractWindow {
if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "participantListPanel") participantListButton.checked = false if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "participantListPanel") participantListButton.checked = false
// Update tab focus properties // Update tab focus properties
var firstContentFocusableItem = Utils.getFirstFocussableItemInItem(rightPanel.contentLoader.item) var firstContentFocusableItem = Utils.getFirstFocusableItemInItem(rightPanel.contentLoader.item)
rightPanel.firstContentFocusableItem = firstContentFocusableItem ?? mainWindow.firstButtonInBottomTab rightPanel.firstContentFocusableItem = firstContentFocusableItem ?? mainWindow.firstButtonInBottomTab
var lastContentFocusableItem = Utils.getLastFocussableItemInItem(rightPanel.contentLoader.item) var lastContentFocusableItem = Utils.getLastFocusableItemInItem(rightPanel.contentLoader.item)
if(lastContentFocusableItem != undefined){ if(lastContentFocusableItem != undefined){
lastContentFocusableItem.KeyNavigation.tab = mainWindow.firstButtonInBottomTab lastContentFocusableItem.KeyNavigation.tab = mainWindow.firstButtonInBottomTab
} }
@ -1302,7 +1302,7 @@ AbstractWindow {
style: ButtonStyle.phoneRedLightBorder style: ButtonStyle.phoneRedLightBorder
Layout.column: mainWindow.startingCall ? 0 : bottomButtonsLayout.columns - 1 Layout.column: mainWindow.startingCall ? 0 : bottomButtonsLayout.columns - 1
KeyNavigation.tab: mainWindow.startingCall ? (videoCameraButton.visible && videoCameraButton.enabled ? videoCameraButton : audioMicrophoneButton) : openStatisticPanelButton KeyNavigation.tab: mainWindow.startingCall ? (videoCameraButton.visible && videoCameraButton.enabled ? videoCameraButton : audioMicrophoneButton) : openStatisticPanelButton
KeyNavigation.backtab: mainWindow.startingCall ? rightPanel.visible ? Utils.getLastFocussableItemInItem(rightPanel) : nextItemInFocusChain(false): callListButton KeyNavigation.backtab: mainWindow.startingCall ? rightPanel.visible ? Utils.getLastFocusableItemInItem(rightPanel) : nextItemInFocusChain(false): callListButton
onClicked: { onClicked: {
mainWindow.callTerminatedByUser = true mainWindow.callTerminatedByUser = true
mainWindow.endCall(mainWindow.call) mainWindow.endCall(mainWindow.call)