File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,18 +177,19 @@ void ImageCanvas::mouseReleaseEvent(QMouseEvent * e) {
177177 if (e->button () == Qt::RightButton) { // selection of label
178178 QColor color = _mask.id .pixel (_mouse_pos / _scale);
179179 const LabelInfo * label = _ui->id_labels [color.red ()];
180-
181- if (!_watershed.id .isNull () && _ui->checkbox_watershed_mask ->isChecked ()) {
182- QColor color = QColor (_watershed.id .pixel (_mouse_pos / _scale));
183- QMap<int , const LabelInfo*>::const_iterator it = _ui->id_labels .find (color.red ());
184- if (it != _ui->id_labels .end ()) {
185- label = it.value ();
180+ if (label != NULL )
181+ {
182+ if (!_watershed.id .isNull () && _ui->checkbox_watershed_mask ->isChecked ()) {
183+ QColor color = QColor (_watershed.id .pixel (_mouse_pos / _scale));
184+ QMap<int , const LabelInfo*>::const_iterator it = _ui->id_labels .find (color.red ());
185+ if (it != _ui->id_labels .end ()) {
186+ label = it.value ();
187+ }
186188 }
189+ if (label->item != NULL )
190+ emit (_ui->list_label ->currentItemChanged (label->item , NULL ));
191+ refresh ();
187192 }
188- if (label->item != NULL )
189- emit (_ui->list_label ->currentItemChanged (label->item , NULL ));
190-
191- refresh ();
192193 }
193194
194195 if (e->button () == Qt::MiddleButton)
You can’t perform that action at this time.
0 commit comments