! \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
| 15384 | \see processRectSelection, QCPLayerable::selectTest |
| 15385 | */ |
| 15386 | void QCustomPlot::processPointSelection(QMouseEvent *event) |
| 15387 | { |
| 15388 | QVariant details; |
| 15389 | QCPLayerable *clickedLayerable = layerableAt(event->pos(), true, &details); |
| 15390 | bool selectionStateChanged = false; |
| 15391 | bool additive = mInteractions.testFlag(QCP::iMultiSelect) && event->modifiers().testFlag(mMultiSelectModifier); |
| 15392 | // deselect all other layerables if not additive selection: |
| 15393 | if (!additive) |
| 15394 | { |
| 15395 | Q_FOREACH (QCPLayer *layer, mLayers) |
| 15396 | { |
| 15397 | Q_FOREACH (QCPLayerable *layerable, layer->children()) |
| 15398 | { |
| 15399 | if (layerable != clickedLayerable && mInteractions.testFlag(layerable->selectionCategory())) |
| 15400 | { |
| 15401 | bool selChanged = false; |
| 15402 | layerable->deselectEvent(&selChanged); |
| 15403 | selectionStateChanged |= selChanged; |
| 15404 | } |
| 15405 | } |
| 15406 | } |
| 15407 | } |
| 15408 | if (clickedLayerable && mInteractions.testFlag(clickedLayerable->selectionCategory())) |
| 15409 | { |
| 15410 | // a layerable was actually clicked, call its selectEvent: |
| 15411 | bool selChanged = false; |
| 15412 | clickedLayerable->selectEvent(event, additive, details, &selChanged); |
| 15413 | selectionStateChanged |= selChanged; |
| 15414 | } |
| 15415 | if (selectionStateChanged) |
| 15416 | { |
| 15417 | Q_EMIT selectionChangedByUser(); |
| 15418 | replot(rpQueuedReplot); |
| 15419 | } |
| 15420 | } |
| 15421 | |
| 15422 | /*! \internal |
| 15423 |
nothing calls this directly
no test coverage detected