diff --git a/src/FlightMap/MapItems/VehicleMapItem.qml b/src/FlightMap/MapItems/VehicleMapItem.qml index 4cdbc434376a0c8fe84d131e1674a1860c19bbd5..2c86665f3471b0f6b1fe1b9cf8c9de0980c3eb7b 100644 --- a/src/FlightMap/MapItems/VehicleMapItem.qml +++ b/src/FlightMap/MapItems/VehicleMapItem.qml @@ -32,15 +32,17 @@ MapQuickItem { property real _uavSize: ScreenTools.defaultFontPixelHeight * 5 property real _adsbSize: ScreenTools.defaultFontPixelHeight * 1.5 property var _map: map + property bool _multiVehicle: QGroundControl.multiVehicleManager.vehicles.count > 1 sourceItem: Item { - id: vehicleItem - width: vehicleIcon.width - height: vehicleIcon.height + id: vehicleItem + width: vehicleIcon.width + height: vehicleIcon.height + opacity: vehicle ? (vehicle.active ? 1.0 : 0.5) : 1.0 Image { id: vehicleIcon - source: _adsbVehicle ? "/qmlimages/adsbVehicle.svg" : (map.isSatelliteMap ? vehicle.vehicleImageOpaque : vehicle.vehicleImageOutline) + source: _adsbVehicle ? "/qmlimages/adsbVehicle.svg" : vehicle.vehicleImageOpaque mipmap: true width: size sourceSize.width: size @@ -57,11 +59,15 @@ MapQuickItem { anchors.top: parent.bottom anchors.horizontalCenter: parent.horizontalCenter map: _map - text: altText + text: vehicleLabelText font.pointSize: ScreenTools.smallFontPointSize - visible: !isNaN(altitude) + visible: _adsbVehicle ? !isNaN(altitude) : _multiVehicle - property string altText: visible ? QGroundControl.metersToAppSettingsDistanceUnits(altitude).toFixed(0) + " " + QGroundControl.appSettingsDistanceUnitsString : "" + property string vehicleLabelText: visible ? + (_adsbVehicle ? + QGroundControl.metersToAppSettingsDistanceUnits(altitude).toFixed(0) + " " + QGroundControl.appSettingsDistanceUnitsString : + (_multiVehicle ? qsTr("Vehicle %1").arg(vehicle.id) : "")) : + "" } } diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index f5b6f6c5962c0be6e1826680e824aab2be7216b3..5581d4438f7cd32c2333905b11f372ebfad44f94 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -1579,7 +1579,10 @@ bool Vehicle::active(void) void Vehicle::setActive(bool active) { - _active = active; + if (_active != active) { + _active = active; + emit activeChanged(_active); + } _startJoystick(_active); }