diff --git a/src/Waypoint.cc b/src/Waypoint.cc index df6ae7bf583851a6b2b354797cee12ada2bf144c..6c3d2f8ef8fec02c436fdcb2c5537b120b32016b 100644 --- a/src/Waypoint.cc +++ b/src/Waypoint.cc @@ -35,6 +35,7 @@ This file is part of the QGROUNDCONTROL project #include "Waypoint.h" Waypoint::Waypoint( + QObject *parent, quint16 id, double x, double y, @@ -49,7 +50,8 @@ Waypoint::Waypoint( int action, const QString& description ) - : _id(id) + : QObject(parent) + , _id(id) , _x(x) , _y(y) , _z(z) @@ -69,6 +71,7 @@ Waypoint::Waypoint( } Waypoint::Waypoint(const Waypoint& other) + : QObject(NULL) { *this = other; } diff --git a/src/Waypoint.h b/src/Waypoint.h index 1d5fcc6521dc540b4ea21dd998ccb8839e45e167..c2618ff7c1f68a21e80a1d1502d916b84c2126dd 100644 --- a/src/Waypoint.h +++ b/src/Waypoint.h @@ -45,6 +45,7 @@ class Waypoint : public QObject Q_OBJECT public: Waypoint( + QObject *parent = 0, quint16 id = 0, double x = 0.0, double y = 0.0, diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 5a05ec7031295e3195d71d1b72b5abb16bdd6653..3b5206dbc6d42fcaae45c1f60a03398d409de749 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -179,12 +179,37 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ if(wp->seq == current_wp_id) { - Waypoint *lwp_vo = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->param1, wp->param2, wp->param3, wp->param4, wp->autocontinue, wp->current, (MAV_FRAME) wp->frame, (MAV_CMD) wp->command); - addWaypointViewOnly(lwp_vo); + Waypoint *lwp_vo = new Waypoint( + NULL, + wp->seq, wp->x, + wp->y, + wp->z, + wp->param1, + wp->param2, + wp->param3, + wp->param4, + wp->autocontinue, + wp->current, + (MAV_FRAME) wp->frame, + (MAV_CMD) wp->command); + addWaypointViewOnly(lwp_vo); if (read_to_edit == true) { - Waypoint *lwp_ed = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->param1, wp->param2, wp->param3, wp->param4, wp->autocontinue, wp->current, (MAV_FRAME) wp->frame, (MAV_CMD) wp->command); + Waypoint *lwp_ed = new Waypoint( + NULL, + wp->seq, + wp->x, + wp->y, + wp->z, + wp->param1, + wp->param2, + wp->param3, + wp->param4, + wp->autocontinue, + wp->current, + (MAV_FRAME) wp->frame, + (MAV_CMD) wp->command); addWaypointEditable(lwp_ed, false); if (wp->current == 1) currentWaypointEditable = lwp_ed; } @@ -216,7 +241,20 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ && wp->seq < waypointsViewOnly.size() && waypointsViewOnly[wp->seq]->getAction()) { // accept single sent waypoints because they can contain updates about remaining DO_JUMP repetitions // but only update view only side - Waypoint *lwp_vo = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->param1, wp->param2, wp->param3, wp->param4, wp->autocontinue, wp->current, (MAV_FRAME) wp->frame, (MAV_CMD) wp->command); + Waypoint *lwp_vo = new Waypoint( + NULL, + wp->seq, + wp->x, + wp->y, + wp->z, + wp->param1, + wp->param2, + wp->param3, + wp->param4, + wp->autocontinue, + wp->current, + (MAV_FRAME) wp->frame, + (MAV_CMD) wp->command); waypointsViewOnly.replace(wp->seq, lwp_vo); emit waypointViewOnlyListChanged();