@@ -73,6 +73,7 @@ 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::advanceCurrentKeypoint, this , &KeypointWidget::advanceCurrentKeypointSlot);
7677
7778 for (const auto & bp : Dataset::dataset->bodypartsList ()) {
7879 QListWidgetItem * bpItem = new QListWidgetItem ();
@@ -167,6 +168,36 @@ void KeypointWidget::suppressKeypointSlot(int row) {
167168}
168169
169170
171+ // we have to do this back and forth dance because the keypointListWidget handles
172+ // suppression (or not) of keypoints. maybe a way to do it all from here, rather than having a method?
173+ // but the method seems generically useful. The downside is then we have to come back and
174+ // update the viewer in a separate slot, so we're sure to not update the current row before the toggle occurs.
175+ void KeypointWidget::toggleCurrentKeypointSlot () {
176+
177+ // figure out which keypointList is currently active
178+ KeypointListWidget* keypointList = keypointListMap[m_currentEntity];
179+
180+ // call the toggleCurrentKeypointSuppression method of this keypointList
181+ // maybe this should be a signal + slot
182+ keypointList->toggleCurrentKeypointSuppression ();
183+ }
184+
185+ void KeypointWidget::advanceCurrentKeypointSlot (){
186+ // figure out which keypointList is currently active
187+ KeypointListWidget* keypointList = keypointListMap[m_currentEntity];
188+
189+ // advance the row to the next keypoint, if possible
190+ if (keypointList->currentRow () < keypointList->count ()-1 ) {
191+ keypointList->setCurrentRow (keypointList->currentRow ()+1 );
192+
193+ // update the viewer accordingly
194+ QColor color = colorMap->getColor (keypointList->currentRow (), keypointList->count ());
195+ m_currentBodypart = keypointList->item (keypointList->currentRow ())->text ();
196+ emit currentBodypartChanged (m_currentBodypart, color);
197+ emit updateViewer ();
198+ }
199+ }
200+
170201void KeypointWidget::unsuppressKeypointSlot (int row) {
171202 QListWidget* keypointList = keypointListMap[m_currentEntity];
172203 keypointList->item (row)->setIcon (QIcon::fromTheme (" no_check" ));
0 commit comments