@@ -73,6 +73,7 @@ void KeypointWidget::init() {
73
73
connect (bodyPartsListWidget, &KeypointListWidget::removeKeypoint, this , &KeypointWidget::removeKeypointSlot);
74
74
connect (bodyPartsListWidget, &KeypointListWidget::suppressKeypoint, this , &KeypointWidget::suppressKeypointSlot);
75
75
connect (bodyPartsListWidget, &KeypointListWidget::unsuppressKeypoint, this , &KeypointWidget::unsuppressKeypointSlot);
76
+ connect (bodyPartsListWidget, &KeypointListWidget::advanceCurrentKeypoint, this , &KeypointWidget::advanceCurrentKeypointSlot);
76
77
77
78
for (const auto & bp : Dataset::dataset->bodypartsList ()) {
78
79
QListWidgetItem * bpItem = new QListWidgetItem ();
@@ -167,6 +168,36 @@ void KeypointWidget::suppressKeypointSlot(int row) {
167
168
}
168
169
169
170
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
+
170
201
void KeypointWidget::unsuppressKeypointSlot (int row) {
171
202
QListWidget* keypointList = keypointListMap[m_currentEntity];
172
203
keypointList->item (row)->setIcon (QIcon::fromTheme (" no_check" ));
0 commit comments