@@ -73,6 +73,8 @@ void KeypointWidget::init() {
7373 connect (bodyPartsListWidget, &KeypointListWidget::removeKeypoint, this , &KeypointWidget::removeKeypointSlot);
7474 connect (bodyPartsListWidget, &KeypointListWidget::suppressKeypoint, this , &KeypointWidget::suppressKeypointSlot);
7575 connect (bodyPartsListWidget, &KeypointListWidget::unsuppressKeypoint, this , &KeypointWidget::unsuppressKeypointSlot);
76+ // connect(bodyPartsListWidget, &KeypointListWidget::toggleCurrentKeypoint, this, &KeypointWidget::toggleCurrentKeypointSlot);
77+ connect (bodyPartsListWidget, &KeypointListWidget::afterToggleSuppression, this , &KeypointWidget::afterToggleSuppressionSlot);
7678
7779 for (const auto & bp : Dataset::dataset->bodypartsList ()) {
7880 QListWidgetItem * bpItem = new QListWidgetItem ();
@@ -167,6 +169,52 @@ void KeypointWidget::suppressKeypointSlot(int row) {
167169}
168170
169171
172+ // we have to do this back and forth dance because the keypointListWidget handles
173+ // suppression (or not) of keypoints. maybe a way to do it all from here, rather than having a method?
174+ // but the method seems generically useful. The downside is then we have to come back and
175+ // update the viewer in a separate slot, so we're sure to not update the current row before the toggle occurs.
176+ void KeypointWidget::toggleCurrentKeypointSlot () {
177+
178+ // figure out which keypointList is currently active
179+ KeypointListWidget* keypointList = keypointListMap[m_currentEntity];
180+
181+ // call the toggleCurrentKeypointSuppression method of this keypointList
182+ // maybe this should be a signal + slot
183+ keypointList->toggleCurrentKeypointSuppression ();
184+ }
185+
186+ void KeypointWidget::afterToggleSuppressionSlot () {
187+
188+ KeypointListWidget* keypointList = keypointListMap[m_currentEntity];
189+
190+ // advance the row to the next keypoint, if possible
191+ if (keypointList->currentRow () < keypointList->count ()-1 ) {
192+ keypointList->setCurrentRow (keypointList->currentRow ()+1 );
193+
194+ // update the viewer accordingly
195+ QColor color = colorMap->getColor (keypointList->currentRow (), keypointList->count ());
196+ m_currentBodypart = keypointList->item (keypointList->currentRow ())->text ();
197+ emit currentBodypartChanged (m_currentBodypart, color);
198+ emit updateViewer ();
199+ }
200+ }
201+
202+ void KeypointWidget::skipCurrentKeypointSlot (){
203+ // figure out which keypointList is currently active
204+ KeypointListWidget* keypointList = keypointListMap[m_currentEntity];
205+
206+ // advance the row to the next keypoint, if possible
207+ if (keypointList->currentRow () < keypointList->count ()-1 ) {
208+ keypointList->setCurrentRow (keypointList->currentRow ()+1 );
209+
210+ // update the viewer accordingly
211+ QColor color = colorMap->getColor (keypointList->currentRow (), keypointList->count ());
212+ m_currentBodypart = keypointList->item (keypointList->currentRow ())->text ();
213+ emit currentBodypartChanged (m_currentBodypart, color);
214+ emit updateViewer ();
215+ }
216+ }
217+
170218void KeypointWidget::unsuppressKeypointSlot (int row) {
171219 QListWidget* keypointList = keypointListMap[m_currentEntity];
172220 keypointList->item (row)->setIcon (QIcon::fromTheme (" no_check" ));
0 commit comments