! \internal This method is called when a simple left mouse click was detected on the QCustomPlot surface. It first determines the layerable that was hit by the click, and then calls its \ref QCPLayerable::selectEvent. All other layerables receive a QCPLayerable::deselectEvent (unless the multi-select modifier was pressed, see \ref setMultiSelectModifier). In this method the hit layera
| 16145 | \see processRectSelection, QCPLayerable::selectTest |
| 16146 | */ |
| 16147 | void QCustomPlot::processPointSelection(QMouseEvent *event) |
| 16148 | { |
| 16149 | QVariant details; |
| 16150 | QCPLayerable *clickedLayerable = layerableAt(event->pos(), true, &details); |
| 16151 | bool selectionStateChanged = false; |
| 16152 | bool additive = mInteractions.testFlag(QCP::iMultiSelect) && event->modifiers().testFlag(mMultiSelectModifier); |
| 16153 | // deselect all other layerables if not additive selection: |
| 16154 | if (!additive) |
| 16155 | { |
| 16156 | foreach (QCPLayer *layer, mLayers) |
| 16157 | { |
| 16158 | foreach (QCPLayerable *layerable, layer->children()) |
| 16159 | { |
| 16160 | if (layerable != clickedLayerable && mInteractions.testFlag(layerable->selectionCategory())) |
| 16161 | { |
| 16162 | bool selChanged = false; |
| 16163 | layerable->deselectEvent(&selChanged); |
| 16164 | selectionStateChanged |= selChanged; |
| 16165 | } |
| 16166 | } |
| 16167 | } |
| 16168 | } |
| 16169 | if (clickedLayerable && mInteractions.testFlag(clickedLayerable->selectionCategory())) |
| 16170 | { |
| 16171 | // a layerable was actually clicked, call its selectEvent: |
| 16172 | bool selChanged = false; |
| 16173 | clickedLayerable->selectEvent(event, additive, details, &selChanged); |
| 16174 | selectionStateChanged |= selChanged; |
| 16175 | } |
| 16176 | if (selectionStateChanged) |
| 16177 | { |
| 16178 | Q_EMIT selectionChangedByUser(); |
| 16179 | replot(rpQueuedReplot); |
| 16180 | } |
| 16181 | } |
| 16182 | |
| 16183 | /*! \internal |
| 16184 |
nothing calls this directly
no test coverage detected