diff --git a/src/ui/MainRootWindow.qml b/src/ui/MainRootWindow.qml index b6086f6232111eb61c5e1fb715c3a0d94d3a6692..c1ef799de9c31d2c33cc47437c23d0c6b06675a1 100644 --- a/src/ui/MainRootWindow.qml +++ b/src/ui/MainRootWindow.qml @@ -555,9 +555,9 @@ ApplicationWindow { //------------------------------------------------------------------------- //-- Indicator Popups - function showPopUp(dropItem, centerX) { - indicatorDropdown.centerX = centerX + function showPopUp(item, dropItem) { indicatorDropdown.currentIndicator = dropItem + indicatorDropdown.currentItem = item indicatorDropdown.open() } @@ -567,8 +567,8 @@ ApplicationWindow { modal: true focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - property var currentIndicator: null - property real centerX: 0 + property var currentItem: null + property var currentIndicator: null background: Rectangle { width: loader.width height: loader.height @@ -577,7 +577,7 @@ ApplicationWindow { Loader { id: loader onLoaded: { - indicatorDropdown.x = mapFromGlobal(indicatorDropdown.centerX, 0).x + indicatorDropdown.x = mainWindow.contentItem.mapFromItem(indicatorDropdown.currentItem, 0, 0).x - (loader.width * 0.5) } } onOpened: { diff --git a/src/ui/toolbar/BatteryIndicator.qml b/src/ui/toolbar/BatteryIndicator.qml index 3bb83b422d952bde501c8c91b249d9aa71309095..7ed8b2ca81890e105f85cc03169e9cb20a07a0a9 100644 --- a/src/ui/toolbar/BatteryIndicator.qml +++ b/src/ui/toolbar/BatteryIndicator.qml @@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- Battery Indicator Item { + id: _root anchors.top: parent.top anchors.bottom: parent.bottom width: batteryIndicatorRow.width @@ -117,8 +118,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToGlobal(x + (width / 2), 0).x - mainWindow.showPopUp(batteryInfo, centerX) + mainWindow.showPopUp(_root, batteryInfo) } } } diff --git a/src/ui/toolbar/GPSIndicator.qml b/src/ui/toolbar/GPSIndicator.qml index ac59b4a2dc55c0056d22f10dbafbdec200f24931..020ea8c4b1137a0610f75b060c4d31cdd339ecfa 100644 --- a/src/ui/toolbar/GPSIndicator.qml +++ b/src/ui/toolbar/GPSIndicator.qml @@ -19,7 +19,7 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- GPS Indicator Item { - id: satelitte + id: _root width: (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1 anchors.top: parent.top anchors.bottom: parent.bottom @@ -107,8 +107,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToGlobal(x + (width / 2), 0).x - mainWindow.showPopUp(gpsInfo, centerX) + mainWindow.showPopUp(_root, gpsInfo) } } } diff --git a/src/ui/toolbar/GPSRTKIndicator.qml b/src/ui/toolbar/GPSRTKIndicator.qml index 8e111591de7538e63db3c1f4d4bde6b016d878e3..d67ae5d2726ad7c8216dc1a7e285e41fafef366b 100644 --- a/src/ui/toolbar/GPSRTKIndicator.qml +++ b/src/ui/toolbar/GPSRTKIndicator.qml @@ -18,7 +18,7 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- GPS Indicator Item { - id: satelitte + id: _root width: visible ? (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1 : 0 anchors.top: parent.top anchors.bottom: parent.bottom @@ -108,8 +108,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToGlobal(x + (width / 2), 0).x - mainWindow.showPopUp(gpsInfo, centerX) + mainWindow.showPopUp(_root, gpsInfo) } } } diff --git a/src/ui/toolbar/JoystickIndicator.qml b/src/ui/toolbar/JoystickIndicator.qml index d7c48763deabeb0be9a9653bd4dde7b6d2fffe75..b094e54bc50721d8df406ad9143b47d2f56f5143 100644 --- a/src/ui/toolbar/JoystickIndicator.qml +++ b/src/ui/toolbar/JoystickIndicator.qml @@ -18,6 +18,7 @@ import QGroundControl.Palette 1.0 // Joystick Indicator Item { + id: _root width: joystickRow.width * 1.1 anchors.top: parent.top anchors.bottom: parent.bottom @@ -90,8 +91,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToGlobal(x + (width / 2), 0).x - mainWindow.showPopUp(joystickInfo, centerX) + mainWindow.showPopUp(_root, joystickInfo) } } } diff --git a/src/ui/toolbar/RCRSSIIndicator.qml b/src/ui/toolbar/RCRSSIIndicator.qml index 0f32a641bdc226acef23505be257c96f7acb9c6e..11ce9b3567f6b0cb27a4b0e5557d3cdea920c391 100644 --- a/src/ui/toolbar/RCRSSIIndicator.qml +++ b/src/ui/toolbar/RCRSSIIndicator.qml @@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- RC RSSI Indicator Item { + id: _root width: rssiRow.width * 1.1 anchors.top: parent.top anchors.bottom: parent.bottom @@ -92,8 +93,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToGlobal(x + (width / 2), 0).x - mainWindow.showPopUp(rcRSSIInfo, centerX) + mainWindow.showPopUp(_root, rcRSSIInfo) } } } diff --git a/src/ui/toolbar/TelemetryRSSIIndicator.qml b/src/ui/toolbar/TelemetryRSSIIndicator.qml index 42cfc921d9fa16bedecbad4c1eb9743ba6a62ebc..c2aaf8c893f4529076cf90d04d25b0fde98746df 100644 --- a/src/ui/toolbar/TelemetryRSSIIndicator.qml +++ b/src/ui/toolbar/TelemetryRSSIIndicator.qml @@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- Telemetry RSSI Item { + id: _root anchors.top: parent.top anchors.bottom: parent.bottom width: _hasTelemetry ? telemIcon.width * 1.1 : 0 @@ -83,8 +84,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToGlobal(x + (width / 2), 0).x - mainWindow.showPopUp(telemRSSIInfo, centerX) + mainWindow.showPopUp(_root, telemRSSIInfo) } } }