i am trying to read the QGC code for second devolopement.
i am QML freshman. and there is a problem bother me a lot, Would be nice to tell me about the answer.
in file PlanView.qml, there is a var ‘object’, as show below, where this ‘object’ declared, and where it come from?
// Add the vehicles to the map
vehicle: object ////------where this 'object' come from?
coordinate: object.coordinate ////------where this 'object' come from?
size: ScreenTools.defaultFontPixelHeight * 3
z: QGroundControl.zOrderMapItems - 1
thanks a lot.
QGroundControl.multiVehicleManager.vehicles is a QmlObjectListModel. “object” is one of the "roles"per the QAbstractListModel implemenation.
Thanks for reply. i do know the ‘object’ is from the QmlObjectListModel, and it is one of the “roles”, as you said. But i can’t find where this ‘object’ declare, i am a C/C++ programer, usually, if there is a var, you should declare it first, then use it. for this ‘object’ we talk about, i can’t trace the position where it declare! , can you tell me the reason, or some clue? thanks.
QHash<int, QByteArray> QmlObjectListModel::roleNames(void) const
QHash<int, QByteArray> hash;
hash[ObjectRole] = "object";
hash[TextRole] = "text";
Thank you for your answer, really appreciate.@DonLakeFlyer