Skip to content

Commit

Permalink
Insure that all of our popups never end up within system margins
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 30, 2025
1 parent 1cff469 commit ef25876
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 29 deletions.
6 changes: 3 additions & 3 deletions src/qml/Changelog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Popup {
id: changelogPopup

parent: mainWindow.contentItem
width: mainWindow.width - Theme.popupScreenEdgeMargin * 2
height: mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4)
x: Theme.popupScreenEdgeMargin
y: Theme.popupScreenEdgeMargin
width: parent.width - Theme.popupScreenEdgeMargin * 2
height: parent.height - Theme.popupScreenEdgeMargin * 2
y: (mainWindow.height - height) / 2
padding: 0
modal: true
closePolicy: Popup.CloseOnEscape
Expand Down
2 changes: 1 addition & 1 deletion src/qml/CodeReader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Popup {
property bool openedOnce: false

width: popupWidth
height: Math.min(mainWindow.height - Theme.popupScreenEdgeMargin, popupWidth + toolBar.height + acceptButton.height)
height: Math.min(mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4), popupWidth + toolBar.height + acceptButton.height)
x: (parent.width - width) / 2
y: (parent.height - height) / 2
z: 10000 // 1000s are embedded feature forms, use a higher value to insure feature form popups always show above embedded feature formes
Expand Down
9 changes: 4 additions & 5 deletions src/qml/EmbeddedFeatureForm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ Popup {
parent: mainWindow.contentItem
closePolicy: form.state === "ReadOnly" ? Popup.CloseOnEscape : Popup.NoAutoClose // prevent accidental feature addition and editing

padding: 0
width: mainWindow.width - Theme.popupScreenEdgeMargin
height: mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4)
x: Theme.popupScreenEdgeMargin / 2
y: Theme.popupScreenEdgeMargin
y: (mainWindow.height - height) / 2
z: 1000 + embeddedLevel

padding: 0
width: parent.width - Theme.popupScreenEdgeMargin
height: parent.height - Theme.popupScreenEdgeMargin * 2
modal: true
focus: visible

Expand Down
9 changes: 6 additions & 3 deletions src/qml/LayerTreeItemProperties.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Popup {

parent: mainWindow.contentItem
width: Math.min(childrenRect.width, mainWindow.width - Theme.popupScreenEdgeMargin)
height: Math.min(popupLayout.childrenRect.height + headerLayout.childrenRect.height + 20, mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4))
x: (mainWindow.width - width) / 2
y: (mainWindow.height - height) / 2
padding: 0
Expand Down Expand Up @@ -60,8 +61,10 @@ Popup {
Page {
id: popupContent
width: parent.width
padding: 0
height: parent.height
padding: 10
header: RowLayout {
id: headerLayout
spacing: 2
Label {
id: titleLabel
Expand Down Expand Up @@ -95,13 +98,13 @@ Popup {
}

ScrollView {
padding: 10
padding: 0
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical: QfScrollBar {
}
contentWidth: popupLayout.childrenRect.width
contentHeight: popupLayout.childrenRect.height
height: Math.min(popupLayout.childrenRect.height + 20, mainWindow.height - mainWindow.sceneTopMargin - mainWindow.sceneBottomMargin)
height: parent.height
clip: true

ColumnLayout {
Expand Down
4 changes: 2 additions & 2 deletions src/qml/PositioningDeviceSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Popup {
signal apply

width: mainWindow.width - Theme.popupScreenEdgeMargin * 2
height: mainWindow.height - Theme.popupScreenEdgeMargin * 2
height: mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4)
x: Theme.popupScreenEdgeMargin
y: Theme.popupScreenEdgeMargin
y: (mainWindow.height - height) / 2
padding: 0
modal: true
focus: visible
Expand Down
2 changes: 1 addition & 1 deletion src/qml/QFieldAudioRecorder.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Popup {
property int popupWidth: Math.min(400, mainWindow.width <= mainWindow.height ? mainWindow.width - Theme.popupScreenEdgeMargin : mainWindow.height - Theme.popupScreenEdgeMargin)

width: popupWidth
height: Math.min(mainWindow.height - Theme.popupScreenEdgeMargin, popupWidth + toolBar.height + recordButton.height)
height: Math.min(mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4), popupWidth + toolBar.height + recordButton.height)
x: (parent.width - width) / 2
y: (parent.height - height) / 2
z: 10000 // 1000s are embedded feature forms, use a higher value to insure feature form popups always show above embedded feature formes
Expand Down
6 changes: 3 additions & 3 deletions src/qml/RelationCombobox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ Item {
id: searchFeaturePopup

parent: mainWindow.contentItem
width: mainWindow.width - Theme.popupScreenEdgeMargin * 2
height: mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4)
x: Theme.popupScreenEdgeMargin
y: Theme.popupScreenEdgeMargin
y: (mainWindow.height - height) / 2
z: 10000 // 1000s are embedded feature forms, use a higher value to insure feature form popups always show above embedded feature formes
width: parent.width - Theme.popupScreenEdgeMargin * 2
height: parent.height - Theme.popupScreenEdgeMargin * 2
padding: 0
modal: true
closePolicy: Popup.CloseOnEscape
Expand Down
10 changes: 5 additions & 5 deletions src/qml/TrackerSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import Theme
*/
Popup {
id: trackInformationPopup
parent: mainWindow.contentItem

x: Theme.popupScreenEdgeMargin / 2
y: Theme.popupScreenEdgeMargin
parent: mainWindow.contentItem
padding: 0
width: parent.width - Theme.popupScreenEdgeMargin
height: parent.height - Theme.popupScreenEdgeMargin * 2
width: mainWindow.width - Theme.popupScreenEdgeMargin
height: mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4)
x: Theme.popupScreenEdgeMargin / 2
y: (mainWindow.height - height) / 2
modal: true
closePolicy: Popup.NoAutoClose

Expand Down
6 changes: 3 additions & 3 deletions src/qml/editorwidgets/ValueMap.qml
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ EditorWidgetBase {
id: searchFeaturePopup

parent: mainWindow.contentItem
width: mainWindow.width - Theme.popupScreenEdgeMargin * 2
height: mainWindow.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4)
x: Theme.popupScreenEdgeMargin
y: Theme.popupScreenEdgeMargin
y: (mainWindow.height - height) / 2
z: 10000 // 1000s are embedded feature forms, use a higher value to insure feature form popups always show above embedded feature formes
width: parent.width - Theme.popupScreenEdgeMargin * 2
height: parent.height - Theme.popupScreenEdgeMargin * 2
padding: 0
modal: true
closePolicy: Popup.CloseOnEscape
Expand Down
6 changes: 3 additions & 3 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3796,10 +3796,10 @@ ApplicationWindow {
Popup {
id: loginDialogPopup
parent: Overlay.overlay
x: Theme.popupScreenEdgeMargin
y: Theme.popupScreenEdgeMargin
width: parent.width - Theme.popupScreenEdgeMargin * 2
height: parent.height - Theme.popupScreenEdgeMargin * 2
height: parent.height - Math.max(Theme.popupScreenEdgeMargin * 2, mainWindow.sceneTopMargin * 2 + 4, mainWindow.sceneBottomMargin * 2 + 4)
x: Theme.popupScreenEdgeMargin
y: (mainWindow.height - height) / 2
padding: 0
modal: true
closePolicy: Popup.CloseOnEscape
Expand Down

0 comments on commit ef25876

Please sign in to comment.