I have a strange issue with the QGCComboBox element. I basically want to send a mavlink message based on what is selected in the drop down menu, but the currentIndex does not always correspond to the selected value. In my example I get a different index if I change from “PIP” to “RGB” then from “IR” to “RGB”. I would expect it to always have the same index if I select “RGB”.
Here is my example code:
QGCComboBox {
//id: displayMode
model: ["PIP", "IR", "RGB"]
onActivated: {
_activeVehicle.sendCommand(_activeVehicle, //ID
183, //MAV_CMD
true, //showError
13, //servo instance
currentIndex*500+1000); //servo value in us
}
}
I also get the same strange behaviour if I explicitly check for the currentText property like this:
if (currentText == "PIP"){
_activeVehicle.sendCommand(_activeVehicle, //ID
183, //MAV_CMD
true, //showError
13, //servo instance
1000); //servo value in us
}
if (currentText == "IR"){
_activeVehicle.sendCommand(_activeVehicle, //ID
183, //MAV_CMD
true, //showError
13, //servo instance
1500); //servo value in us
}
if (currentText == "RGB"){
_activeVehicle.sendCommand(_activeVehicle, //ID
183, //MAV_CMD
true, //showError
13, //servo instance
2000); //servo value in us
}
Any help would be appreciated…