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

View file

@ -38,7 +38,7 @@ AbstractWindow {
== LinphoneEnums.CallState.OutgoingEarlyMedia
|| mainWindow.callState == LinphoneEnums.CallState.IncomingReceived
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: {
if (callState === LinphoneEnums.CallState.Connected) {
@ -738,9 +738,9 @@ AbstractWindow {
if (!rightPanel.contentLoader.item || rightPanel.contentLoader.item.objectName !== "participantListPanel") participantListButton.checked = false
// Update tab focus properties
var firstContentFocusableItem = Utils.getFirstFocussableItemInItem(rightPanel.contentLoader.item)
var firstContentFocusableItem = Utils.getFirstFocusableItemInItem(rightPanel.contentLoader.item)
rightPanel.firstContentFocusableItem = firstContentFocusableItem ?? mainWindow.firstButtonInBottomTab
var lastContentFocusableItem = Utils.getLastFocussableItemInItem(rightPanel.contentLoader.item)
var lastContentFocusableItem = Utils.getLastFocusableItemInItem(rightPanel.contentLoader.item)
if(lastContentFocusableItem != undefined){
lastContentFocusableItem.KeyNavigation.tab = mainWindow.firstButtonInBottomTab
}
@ -1302,7 +1302,7 @@ AbstractWindow {
style: ButtonStyle.phoneRedLightBorder
Layout.column: mainWindow.startingCall ? 0 : bottomButtonsLayout.columns - 1
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: {
mainWindow.callTerminatedByUser = true
mainWindow.endCall(mainWindow.call)