From aa7b4b459eefac9864b6d286f7b7c9de410b5ec7 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 19 May 2014 13:09:59 +0200 Subject: [PATCH] Fix up waypoint handling to not flicker on current WP change state --- src/Waypoint.cc | 3 ++- src/uas/UASWaypointManager.cc | 2 +- src/ui/WaypointEditableView.cc | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Waypoint.cc b/src/Waypoint.cc index 40447c1..dc9d3a6 100644 --- a/src/Waypoint.cc +++ b/src/Waypoint.cc @@ -216,7 +216,8 @@ void Waypoint::setCurrent(bool current) if (this->current != current) { this->current = current; - emit changed(this); + // The current waypoint index is handled by the list + // and not part of the individual waypoint update state } } diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 33a46f3..6fc55a2 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -347,7 +347,7 @@ int UASWaypointManager::setCurrentEditable(quint16 seq) if (seq < waypointsEditable.count()) { if(current_state == WP_IDLE) { //update local main storage - for(int i = 0; i < waypointsEditable.count(); i++) { + for (int i = 0; i < waypointsEditable.count(); i++) { if (waypointsEditable[i]->getId() == seq) { waypointsEditable[i]->setCurrent(true); } else { diff --git a/src/ui/WaypointEditableView.cc b/src/ui/WaypointEditableView.cc index 9c1bbf6..9c9e17c 100644 --- a/src/ui/WaypointEditableView.cc +++ b/src/ui/WaypointEditableView.cc @@ -369,7 +369,10 @@ void WaypointEditableView::changedCurrent(int state) else { wp->setCurrent(true); - emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false + // At this point we do not consider this signal + // to be valid / the edit check boxes should not change the view state + //emit changeCurrentWaypoint(wp->getId()); + //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false } } @@ -485,7 +488,10 @@ void WaypointEditableView::updateValues() if (m_ui->selectedBox->isChecked() != wp->getCurrent()) { + // This is never a reason to emit a changed signal + m_ui->selectedBox->blockSignals(true); m_ui->selectedBox->setChecked(wp->getCurrent()); + m_ui->selectedBox->blockSignals(false); } if (m_ui->autoContinue->isChecked() != wp->getAutoContinue()) { @@ -578,9 +584,12 @@ void WaypointEditableView::updateValues() void WaypointEditableView::setCurrent(bool state) { - m_ui->selectedBox->blockSignals(true); - m_ui->selectedBox->setChecked(state); - m_ui->selectedBox->blockSignals(false); + if (m_ui->selectedBox->isChecked() != state) + { + m_ui->selectedBox->blockSignals(true); + m_ui->selectedBox->setChecked(state); + m_ui->selectedBox->blockSignals(false); + } }