| 676 | } |
| 677 | |
| 678 | void DatapickerImageView::changeSelectedItemsPosition(QAction* action) { |
| 679 | if (scene()->selectedItems().isEmpty()) |
| 680 | return; |
| 681 | |
| 682 | QPointF shift(0, 0); |
| 683 | if (action == shiftLeftAction) |
| 684 | shift.setX(1); |
| 685 | else if (action == shiftRightAction) |
| 686 | shift.setX(-1); |
| 687 | else if (action == shiftUpAction) |
| 688 | shift.setY(-1); |
| 689 | else if (action == shiftDownAction) |
| 690 | shift.setY(1); |
| 691 | |
| 692 | m_image->beginMacro(i18n("%1: change position of selected DatapickerPoints.", m_image->name())); |
| 693 | const QVector<DatapickerPoint*> axisPoints = m_image->children<DatapickerPoint>(AbstractAspect::ChildIndexFlag::IncludeHidden); |
| 694 | for (auto* point : axisPoints) { |
| 695 | if (!point->graphicsItem()->isSelected()) |
| 696 | continue; |
| 697 | |
| 698 | QPointF newPos = point->position(); |
| 699 | newPos = newPos + shift; |
| 700 | point->setPosition(newPos); |
| 701 | |
| 702 | int pointIndex = m_image->indexOfChild<DatapickerPoint>(point, AbstractAspect::ChildIndexFlag::IncludeHidden); |
| 703 | if (pointIndex == -1) |
| 704 | continue; |
| 705 | DatapickerImage::ReferencePoints points = m_image->axisPoints(); |
| 706 | points.scenePos[pointIndex].setX(point->position().x()); |
| 707 | points.scenePos[pointIndex].setY(point->position().y()); |
| 708 | m_image->setUndoAware(false); |
| 709 | m_image->setAxisPoints(points); |
| 710 | m_image->setUndoAware(true); |
| 711 | } |
| 712 | |
| 713 | for (auto* curve : m_image->parentAspect()->children<DatapickerCurve>()) { |
| 714 | for (auto* point : curve->children<DatapickerPoint>(AbstractAspect::ChildIndexFlag::IncludeHidden)) { |
| 715 | if (!point->graphicsItem()->isSelected()) |
| 716 | continue; |
| 717 | |
| 718 | QPointF newPos = point->position(); |
| 719 | newPos = newPos + shift; |
| 720 | point->setPosition(newPos); |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | m_image->endMacro(); |
| 725 | if (m_image->m_magnificationWindow && m_image->m_magnificationWindow->isVisible()) |
| 726 | updateMagnificationWindow(); |
| 727 | } |
| 728 | |
| 729 | void DatapickerImageView::magnificationChanged(QAction* action) { |
| 730 | if (action == noMagnificationAction) { |
nothing calls this directly
no test coverage detected