I connect the IdentifyLayerCompleted signal with a slot, in which I check the TaskWatcher's taskId() to make sure I have the correct signal.
However, every time I execute the identifyLayer method, the number of time this slot is called increases, using the same taskID for each call.
How can I remove this extra signal calls ?
void Myclass::mouseClickedSlot(QMouseEvent& mouseEvent)
{
connect(_mapView, &MapQuickView::identifyLayerCompleted, this, &Myclass::clickedSlot);
for (int i = 0; i < _map->operationalLayers()->rowCount(); ++i) {
FeatureLayer* thisLayer = (FeatureLayer*)(_map->operationalLayers()->at(i));
TaskWatcher tw = _mapView->identifyLayer(thisLayer, mouseEvent.x(), mouseEvent.y(), 10, false, 10);
_identifyTasks.push_back(tw.taskId());
}
}
void Myclass::clickedSlot(QUuid taskID, IdentifyLayerResult* identifyResult)
{
if (find(_identifyTasks.begin(), _identifyTasks.end(), taskID) == _selectedTasks.end()) {
// not the taskID I was expecting
return;
}
// do something, depending on the layer
// ...
}