MCPcopy Create free account
hub / github.com/KDE/labplot / setMarkerpointPosition

Method setMarkerpointPosition

src/backend/worksheet/InfoElement.cpp:726–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726double InfoElement::setMarkerpointPosition(double x) {
727 // TODO: can be optimized when it will be checked if all markerpoints have the same xColumn, then the index m_index is the same
728 Q_D(InfoElement);
729 updateValid();
730 double x_new;
731 double x_new_first = 0;
732 for (int i = 0; i < markerpoints.length(); i++) {
733 auto* point = markerpoints[i].customPoint;
734 bool valueFound;
735 double y = markerpoints[i].curve->y(x, x_new, valueFound);
736 m_suppressVisibleChange = true;
737 if (y == std::nan("0")) {
738 point->setVisible(false);
739 m_title->setVisible(false);
740 } else {
741 point->setVisible(markerpoints[i].visible);
742 m_title->setVisible(true);
743 }
744 m_suppressVisibleChange = false;
745 d->positionLogical = x_new;
746 if (i == 0)
747 x_new_first = x_new;
748
749 if (valueFound) {
750 m_suppressChildPositionChanged = true;
751 point->graphicsItem()->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
752 point->setUndoAware(false);
753 point->setPositionLogical(QPointF(x_new, y));
754 point->setUndoAware(false);
755 point->graphicsItem()->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
756 m_suppressChildPositionChanged = false;
757 }
758 }
759 return x_new_first;
760}
761
762/*!
763 * Will be called, when the customPoint changes his position

Callers

nothing calls this directly

Calls 7

lengthMethod · 0.80
setUndoAwareMethod · 0.80
QPointFClass · 0.50
yMethod · 0.45
setVisibleMethod · 0.45
graphicsItemMethod · 0.45
setPositionLogicalMethod · 0.45

Tested by

no test coverage detected