diff --git a/Linphone/view/App/Main.qml b/Linphone/view/App/Main.qml index e1912d4c2..a1171ea50 100644 --- a/Linphone/view/App/Main.qml +++ b/Linphone/view/App/Main.qml @@ -14,9 +14,6 @@ Window { // TODO : handle this bool when security mode is implemented property bool firstConnection: true - // access window properties from all its children - // (used in popupbutton to see if the popup exceed window height) - property Window mainApplicationWindow: mainWindow function goToNewCall() { mainWindowStackView.replace(mainPage, StackView.Immediate) diff --git a/Linphone/view/Item/PopupButton.qml b/Linphone/view/Item/PopupButton.qml index cc370398b..12c5b7484 100644 --- a/Linphone/view/Item/PopupButton.qml +++ b/Linphone/view/Item/PopupButton.qml @@ -34,13 +34,15 @@ Button { x: - width y: mainItem.height closePolicy: Popup.CloseOnPressOutsideParent |Popup.CloseOnPressOutside + parent: mainItem // Explicit define for coordinates references. onAboutToShow: { - if (mainApplicationWindow == undefined) return; - var coord = mapToGlobal(mainItem.x, mainItem.y) - if (coord.y + popup.height >= mainApplicationWindow.height) { - y = -popup.height - } else { + // Do not use popup.height as it is not consistent. + var position = mainItem.mapToItem(mainItem.Window.contentItem, mainItem.x, mainItem.y + mainItem.height + popup.implicitContentHeight + popup.padding) + if (position.y >= mainItem.Window.height) { + position = mainItem.Window.contentItem.mapToItem(mainItem, 0,0) + y = position.y + }else { y = mainItem.height } }