Commit 7e5b45a9 authored by Gus Grubba's avatar Gus Grubba

Fix indicator dropdowns x position on screen

parent 1e54c4ba
...@@ -555,9 +555,9 @@ ApplicationWindow { ...@@ -555,9 +555,9 @@ ApplicationWindow {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Indicator Popups //-- Indicator Popups
function showPopUp(dropItem, centerX) { function showPopUp(item, dropItem) {
indicatorDropdown.centerX = centerX
indicatorDropdown.currentIndicator = dropItem indicatorDropdown.currentIndicator = dropItem
indicatorDropdown.currentItem = item
indicatorDropdown.open() indicatorDropdown.open()
} }
...@@ -567,8 +567,8 @@ ApplicationWindow { ...@@ -567,8 +567,8 @@ ApplicationWindow {
modal: true modal: true
focus: true focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
property var currentIndicator: null property var currentItem: null
property real centerX: 0 property var currentIndicator: null
background: Rectangle { background: Rectangle {
width: loader.width width: loader.width
height: loader.height height: loader.height
...@@ -577,7 +577,7 @@ ApplicationWindow { ...@@ -577,7 +577,7 @@ ApplicationWindow {
Loader { Loader {
id: loader id: loader
onLoaded: { onLoaded: {
indicatorDropdown.x = mapFromGlobal(indicatorDropdown.centerX, 0).x indicatorDropdown.x = mainWindow.contentItem.mapFromItem(indicatorDropdown.currentItem, 0, 0).x - (loader.width * 0.5)
} }
} }
onOpened: { onOpened: {
......
...@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 ...@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Battery Indicator //-- Battery Indicator
Item { Item {
id: _root
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: batteryIndicatorRow.width width: batteryIndicatorRow.width
...@@ -117,8 +118,7 @@ Item { ...@@ -117,8 +118,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(_root, batteryInfo)
mainWindow.showPopUp(batteryInfo, centerX)
} }
} }
} }
...@@ -19,7 +19,7 @@ import QGroundControl.Palette 1.0 ...@@ -19,7 +19,7 @@ import QGroundControl.Palette 1.0
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- GPS Indicator //-- GPS Indicator
Item { Item {
id: satelitte id: _root
width: (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1 width: (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
...@@ -107,8 +107,7 @@ Item { ...@@ -107,8 +107,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(_root, gpsInfo)
mainWindow.showPopUp(gpsInfo, centerX)
} }
} }
} }
...@@ -18,7 +18,7 @@ import QGroundControl.Palette 1.0 ...@@ -18,7 +18,7 @@ import QGroundControl.Palette 1.0
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- GPS Indicator //-- GPS Indicator
Item { Item {
id: satelitte id: _root
width: visible ? (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1 : 0 width: visible ? (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1 : 0
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
...@@ -108,8 +108,7 @@ Item { ...@@ -108,8 +108,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(_root, gpsInfo)
mainWindow.showPopUp(gpsInfo, centerX)
} }
} }
} }
...@@ -18,6 +18,7 @@ import QGroundControl.Palette 1.0 ...@@ -18,6 +18,7 @@ import QGroundControl.Palette 1.0
// Joystick Indicator // Joystick Indicator
Item { Item {
id: _root
width: joystickRow.width * 1.1 width: joystickRow.width * 1.1
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
...@@ -90,8 +91,7 @@ Item { ...@@ -90,8 +91,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(_root, joystickInfo)
mainWindow.showPopUp(joystickInfo, centerX)
} }
} }
} }
...@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 ...@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- RC RSSI Indicator //-- RC RSSI Indicator
Item { Item {
id: _root
width: rssiRow.width * 1.1 width: rssiRow.width * 1.1
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
...@@ -92,8 +93,7 @@ Item { ...@@ -92,8 +93,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(_root, rcRSSIInfo)
mainWindow.showPopUp(rcRSSIInfo, centerX)
} }
} }
} }
...@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 ...@@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Telemetry RSSI //-- Telemetry RSSI
Item { Item {
id: _root
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: _hasTelemetry ? telemIcon.width * 1.1 : 0 width: _hasTelemetry ? telemIcon.width * 1.1 : 0
...@@ -83,8 +84,7 @@ Item { ...@@ -83,8 +84,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(_root, telemRSSIInfo)
mainWindow.showPopUp(telemRSSIInfo, centerX)
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment