Browse Source

Fix indicator dropdowns x position on screen

QGC4.4
Gus Grubba 6 years ago
parent
commit
7e5b45a99c
  1. 10
      src/ui/MainRootWindow.qml
  2. 4
      src/ui/toolbar/BatteryIndicator.qml
  3. 5
      src/ui/toolbar/GPSIndicator.qml
  4. 5
      src/ui/toolbar/GPSRTKIndicator.qml
  5. 4
      src/ui/toolbar/JoystickIndicator.qml
  6. 4
      src/ui/toolbar/RCRSSIIndicator.qml
  7. 4
      src/ui/toolbar/TelemetryRSSIIndicator.qml

10
src/ui/MainRootWindow.qml

@ -555,9 +555,9 @@ ApplicationWindow { @@ -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 { @@ -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 { @@ -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: {

4
src/ui/toolbar/BatteryIndicator.qml

@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 @@ -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 { @@ -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)
}
}
}

5
src/ui/toolbar/GPSIndicator.qml

@ -19,7 +19,7 @@ import QGroundControl.Palette 1.0 @@ -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 { @@ -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)
}
}
}

5
src/ui/toolbar/GPSRTKIndicator.qml

@ -18,7 +18,7 @@ import QGroundControl.Palette 1.0 @@ -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 { @@ -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)
}
}
}

4
src/ui/toolbar/JoystickIndicator.qml

@ -18,6 +18,7 @@ import QGroundControl.Palette 1.0 @@ -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 { @@ -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)
}
}
}

4
src/ui/toolbar/RCRSSIIndicator.qml

@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 @@ -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 { @@ -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)
}
}
}

4
src/ui/toolbar/TelemetryRSSIIndicator.qml

@ -19,6 +19,7 @@ import QGroundControl.Palette 1.0 @@ -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 { @@ -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)
}
}
}

Loading…
Cancel
Save