diff --git a/src/Waypoint.h b/src/Waypoint.h index 6f5477c0a2d4b88dd8213d560e4841835d69c7c5..35999a264872665659cdb099048c28ff0fc205ed 100644 --- a/src/Waypoint.h +++ b/src/Waypoint.h @@ -123,6 +123,7 @@ public: const QString& getDescription() const { return description; } + /** @brief Returns true if x, y, z contain reasonable navigation data */ bool isNavigationType(); @@ -185,6 +186,9 @@ public slots: bool isReached() { return (reachedTime > 0); } /** @brief Get the time this waypoint was reached */ quint64 getReachedTime() { return reachedTime; } + void setChanged() { + emit changed(this); + } signals: /** @brief Announces a change to the waypoint data */ diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index f98ba0043088f89ea82a8eccdbe7c20fa1947ec3..6e47c7f52eadb105c5367b812abfe282348c7e51 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -173,6 +173,7 @@ void QGCMapWidget::mouseReleaseEvent(QMouseEvent *event) // If the mouse is released, we can't be dragging if (firingWaypointChange) { + firingWaypointChange->setChanged(); firingWaypointChange = NULL; } } @@ -638,13 +639,6 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) if (!wp) WPDelete(waypoint); - // Protect from vicious double update cycle - if (firingWaypointChange == wp) { - return; - } - // Not in cycle, block now from entering it - firingWaypointChange = wp; - // Update WP values internals::PointLatLng pos = waypoint->Coord(); @@ -661,6 +655,13 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) // QString wp_str = QString::number(wp->getLatitude(), 'f', 6) + " " + QString::number(wp->getLongitude(), 'f', 6); // qDebug() << "MAP WP COORD (WP):" << wp_str << __FILE__ << __LINE__; + // Protect from vicious double update cycle + if (firingWaypointChange == wp) { + return; + } + // Not in cycle, block now from entering it + firingWaypointChange = wp; + emit waypointChanged(wp); }