Hi Soni,
Excellent diagnostic work. These results narrow the problem down considerably.
Since both trajectory lists are growing independently, I would focus on the QML signal connection and map rendering path rather than changing the C++ trajectory collection logic.
I suggest the following approach.
1. Verify the actual signal source
First, confirm that vehicleObj.trajectoryPoints resolves to the expected QObject instance and that its pointAdded and updateLastPoint signals are declared and exposed to QML.
A growing list does not necessarily prove that these signals are being emitted.
2. Establish an explicit connection
Inside the trajectory delegate, try:
Connections {
target: vehicleTrajectoryPolyline.vehicleObj
? vehicleTrajectoryPolyline.vehicleObj.trajectoryPoints
: null
ignoreUnknownSignals: false
function onPointAdded() {
console.log("TRAJ: pointAdded received")
vehicleTrajectoryPolyline.refreshPath()
}
function onUpdateLastPoint() {
console.log("TRAJ: updateLastPoint received")
vehicleTrajectoryPolyline.refreshPath()
}
}
This assumes the C++ signals have compatible signatures and refreshPath() is implemented on the delegate.
3. Implement an explicit path refresh
For diagnostic purposes, rebuild the map path from the current trajectory list whenever either signal is received.
Use the actual coordinate property exposed by your TrajectoryPoints implementation.
This will help establish whether the remaining problem is signal delivery or map rendering.
4. Test rendering independently
Since the lists already contain valid trajectory points, temporarily populate the MapPolyline using the existing list without relying on signals.
If the trajectory becomes visible, we can isolate the issue to notification or refresh handling.
If it remains invisible, check the MapItemView delegate structure, coordinate conversion, map item ownership, visibility, and polyline styling.
5. Verify delegate lifetime
Because this is a multi-vehicle configuration, ensure each delegate maintains its own vehicle reference and signal connection.
Also check whether the Connections target changes or becomes null when the active vehicle changes.
I would avoid modifying Vehicle.cc until these checks are complete.
Expected validation:
-
Both vehicles retain independent trajectory histories.
-
Each trajectory appears on the map.
-
New points update the correct vehicle’s polyline.
-
Switching the active vehicle does not interrupt either trajectory.
-
No QML signal or binding warnings occur.
The most useful next result would be whether manually rebuilding the polyline from the existing list makes both trajectories visible.
That will distinguish a signal propagation problem from a rendering problem.
Best regards,
Yiğitcan