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

Method updatePosition

src/backend/worksheet/TextLabel.cpp:575–599  ·  view source on GitHub ↗

! calculates the position of the label, when the position relative to the parent was specified (left, right, etc.) */

Source from the content-addressed store, hash-verified

573 calculates the position of the label, when the position relative to the parent was specified (left, right, etc.)
574*/
575void TextLabelPrivate::updatePosition() {
576 if (q->isLoading())
577 return;
578
579 if (q->m_type == TextLabel::Type::AxisTitle) {
580 // In an axis element, the label is part of the bounding rect of the axis
581 // so it is not possible to align with the bounding rect
582 QPointF p = position.point;
583 suppressItemChangeEvent = true;
584 setPos(p);
585 suppressItemChangeEvent = false;
586
587 Q_EMIT q->positionChanged(position);
588
589 // the position in scene coordinates was changed, calculate the position in logical coordinates
590 if (q->cSystem) {
591 if (!coordinateBindingEnabled) {
592 QPointF pos = q->align(p, m_boundingRectangle, horizontalAlignment, verticalAlignment, false);
593 positionLogical = q->cSystem->mapSceneToLogical(pos, AbstractCoordinateSystem::MappingFlag::SuppressPageClipping);
594 }
595 Q_EMIT q->positionLogicalChanged(positionLogical);
596 }
597 } else
598 WorksheetElementPrivate::updatePosition();
599}
600
601/*!
602 updates the static text.

Callers 3

initMethod · 0.45
setTextMethod · 0.45
setParentGraphicsItemMethod · 0.45

Calls 3

isLoadingMethod · 0.80
alignMethod · 0.80
mapSceneToLogicalMethod · 0.45

Tested by

no test coverage detected