Fix popup display

This commit is contained in:
Julien Wadel 2024-03-13 13:05:43 +01:00
parent fbb83249b8
commit 6d96359b0a
2 changed files with 7 additions and 8 deletions

View file

@ -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)

View file

@ -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
}
}