Hello All,
I’m trying to add a new button to fly view under the Zoom out button.
I’ve added this code to the FlightDisplayViewWidgets.QML file(mapZoomMinus Round button is working i’ve added the navLight button) :
RoundButton { <<<< Good/Working
id: mapZoomMinus
visible: !ScreenTools.isTinyScreen && _mainIsMap
buttonImage: “/qmlimages/ZoomMinus.svg”
exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets
lightBorders: _lightWidgetBorders
onClicked: {
if(_flightMap)
_flightMap.zoomLevel -= 0.5
checked = false
}
}
RoundButton { <<<<<Not Good/working
id: navLight
visible: true
buttonImage: “/qmlimages/NavLight.svg”
exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets
lightBorders: _lightWidgetBorders
onClicked: _activeVehicle.setNavLight(checked)
}
In Vehicle.h i’ve added :
Q_INVOKABLE void setNavLight(bool newStatus);
and the implementation is in Vehicle.cc.
The problem is that i’m keep getting : TypeError: Cannot call method ‘setNavLight’ of null .
Does anyone have any idea how to solve this issue??
more relevent idea:
- tried using also public slot and still got the same error.
- tried calling other QGC default function to the _activeVehicle object and still got the same error.
Any help will be highly appreciated.
Thanks,