| 4087 | double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value |
| 4088 | |
| 4089 | foreach (QCPAbstractPlottable *plottable, mPlottables) |
| 4090 | { |
| 4091 | PlottableType *currentPlottable = qobject_cast<PlottableType*>(plottable); |
| 4092 | if (!currentPlottable || (onlySelectable && !currentPlottable->selectable())) // we could have also passed onlySelectable to the selectTest function, but checking here is faster, because we have access to QCPAbstractPlottable::selectable |
| 4093 | continue; |
| 4094 | if (currentPlottable->clipRect().contains(pos.toPoint())) // only consider clicks where the plottable is actually visible |
| 4095 | { |
| 4096 | QVariant details; |
| 4097 | double currentDistance = currentPlottable->selectTest(pos, false, dataIndex ? &details : nullptr); |
| 4098 | if (currentDistance >= 0 && currentDistance < resultDistance) |
| 4099 | { |
| 4100 | resultPlottable = currentPlottable; |
| 4101 | resultDetails = details; |
| 4102 | resultDistance = currentDistance; |
| 4103 | } |
| 4104 | } |
| 4105 | } |
| 4106 | |
| 4107 | if (resultPlottable && dataIndex) |
| 4108 | { |
nothing calls this directly
no test coverage detected