Fix popup display
This commit is contained in:
parent
fbb83249b8
commit
6d96359b0a
2 changed files with 7 additions and 8 deletions
|
|
@ -14,9 +14,6 @@ Window {
|
||||||
// TODO : handle this bool when security mode is implemented
|
// TODO : handle this bool when security mode is implemented
|
||||||
property bool firstConnection: true
|
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() {
|
function goToNewCall() {
|
||||||
mainWindowStackView.replace(mainPage, StackView.Immediate)
|
mainWindowStackView.replace(mainPage, StackView.Immediate)
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,15 @@ Button {
|
||||||
x: - width
|
x: - width
|
||||||
y: mainItem.height
|
y: mainItem.height
|
||||||
closePolicy: Popup.CloseOnPressOutsideParent |Popup.CloseOnPressOutside
|
closePolicy: Popup.CloseOnPressOutsideParent |Popup.CloseOnPressOutside
|
||||||
|
parent: mainItem // Explicit define for coordinates references.
|
||||||
|
|
||||||
onAboutToShow: {
|
onAboutToShow: {
|
||||||
if (mainApplicationWindow == undefined) return;
|
// Do not use popup.height as it is not consistent.
|
||||||
var coord = mapToGlobal(mainItem.x, mainItem.y)
|
var position = mainItem.mapToItem(mainItem.Window.contentItem, mainItem.x, mainItem.y + mainItem.height + popup.implicitContentHeight + popup.padding)
|
||||||
if (coord.y + popup.height >= mainApplicationWindow.height) {
|
if (position.y >= mainItem.Window.height) {
|
||||||
y = -popup.height
|
position = mainItem.Window.contentItem.mapToItem(mainItem, 0,0)
|
||||||
} else {
|
y = position.y
|
||||||
|
}else {
|
||||||
y = mainItem.height
|
y = mainItem.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue