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

Method updatePosition

src/backend/worksheet/WorksheetElement.cpp:867–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

865}
866
867void WorksheetElementPrivate::updatePosition() {
868 DEBUG(Q_FUNC_INFO)
869 QPointF p;
870 if (coordinateBindingEnabled && q->cSystem) {
871 // the position in logical coordinates was changed, calculate the position in scene coordinates
872 // insidePlot will get false if the point lies outside of the datarect
873 p = q->cSystem->mapLogicalToScene(positionLogical, insidePlot, AbstractCoordinateSystem::MappingFlag::SuppressPageClippingVisible);
874 position.point = q->parentPosToRelativePos(mapPlotAreaToParent(p), position);
875 Q_EMIT q->positionChanged(position);
876 } else {
877 insidePlot = true; // not important if within the datarect or not
878 p = q->relativePosToParentPos(position);
879
880 // the position in scene coordinates was changed, calculate the position in logical coordinates
881 if (q->cSystem && q->cSystem->isValid()) {
882 positionLogical = q->cSystem->mapSceneToLogical(mapParentToPlotArea(p), AbstractCoordinateSystem::MappingFlag::SuppressPageClipping);
883 Q_EMIT q->positionLogicalChanged(positionLogical);
884 }
885 }
886
887 p = q->align(p, boundingRect(), horizontalAlignment, verticalAlignment, true);
888
889 suppressItemChangeEvent = true;
890 setPos(p);
891 suppressItemChangeEvent = false;
892
893 Q_EMIT q->changed();
894}
895
896bool WorksheetElementPrivate::sceneEvent(QEvent* event) {
897 // don't allow to move the element with the mouse or with the cursor keys if it's locked

Callers 1

Calls 6

mapLogicalToSceneMethod · 0.80
alignMethod · 0.80
isValidMethod · 0.45
mapSceneToLogicalMethod · 0.45

Tested by

no test coverage detected