| 865 | } |
| 866 | |
| 867 | void 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 | |
| 896 | bool WorksheetElementPrivate::sceneEvent(QEvent* event) { |
| 897 | // don't allow to move the element with the mouse or with the cursor keys if it's locked |
no test coverage detected