MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / processPointSelection

Method processPointSelection

qcustomplot.cpp:15413–15447  ·  view source on GitHub ↗

! \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

Source from the content-addressed store, hash-verified

15411 \see processRectSelection, QCPLayerable::selectTest
15412*/
15413void QCustomPlot::processPointSelection(QMouseEvent *event)
15414{
15415 QVariant details;
15416 QCPLayerable *clickedLayerable = layerableAt(event->pos(), true, &details);
15417 bool selectionStateChanged = false;
15418 bool additive = mInteractions.testFlag(QCP::iMultiSelect) && event->modifiers().testFlag(mMultiSelectModifier);
15419 // deselect all other layerables if not additive selection:
15420 if (!additive)
15421 {
15422 foreach (QCPLayer *layer, mLayers)
15423 {
15424 foreach (QCPLayerable *layerable, layer->children())
15425 {
15426 if (layerable != clickedLayerable && mInteractions.testFlag(layerable->selectionCategory()))
15427 {
15428 bool selChanged = false;
15429 layerable->deselectEvent(&selChanged);
15430 selectionStateChanged |= selChanged;
15431 }
15432 }
15433 }
15434 }
15435 if (clickedLayerable && mInteractions.testFlag(clickedLayerable->selectionCategory()))
15436 {
15437 // a layerable was actually clicked, call its selectEvent:
15438 bool selChanged = false;
15439 clickedLayerable->selectEvent(event, additive, details, &selChanged);
15440 selectionStateChanged |= selChanged;
15441 }
15442 if (selectionStateChanged)
15443 {
15444 emit selectionChangedByUser();
15445 replot(rpQueuedReplot);
15446 }
15447}
15448
15449/*! \internal
15450

Callers

nothing calls this directly

Calls 2

selectionCategoryMethod · 0.80
selectEventMethod · 0.80

Tested by

no test coverage detected