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

Method cartesianPlotAxisShift

src/backend/worksheet/Worksheet.cpp:989–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

987}
988
989void Worksheet::cartesianPlotAxisShift(int delta, Dimension dim, int index) {
990 const auto& plots = children<CartesianPlot>(AbstractAspect::ChildIndexFlag::Recursive | AbstractAspect::ChildIndexFlag::IncludeHidden);
991 const auto cursorMode = cartesianPlotActionMode();
992 bool leftOrDown = false;
993 if (delta < 0)
994 leftOrDown = true;
995
996 switch (cursorMode) {
997 case CartesianPlotActionMode::ApplyActionToAll: {
998 for (auto* plot : plots)
999 plot->shift(-1, dim, leftOrDown);
1000 break;
1001 }
1002 case CartesianPlotActionMode::ApplyActionToAllX: {
1003 switch (dim) {
1004 case Dimension::X: {
1005 for (auto* plot : plots)
1006 plot->shift(-1, dim, leftOrDown);
1007 break;
1008 }
1009 case Dimension::Y: {
1010 auto* plot = static_cast<CartesianPlot*>(QObject::sender());
1011 plot->shift(index, dim, leftOrDown);
1012 break;
1013 }
1014 }
1015 break;
1016 }
1017 case CartesianPlotActionMode::ApplyActionToAllY: {
1018 switch (dim) {
1019 case Dimension::X: {
1020 for (auto* plot : plots)
1021 plot->shift(index, dim, leftOrDown);
1022 break;
1023 }
1024 case Dimension::Y: {
1025 auto* plot = static_cast<CartesianPlot*>(QObject::sender());
1026 plot->shift(-1, dim, leftOrDown);
1027 break;
1028 }
1029 }
1030 break;
1031 }
1032 case CartesianPlotActionMode::ApplyActionToSelection: {
1033 auto* plot = static_cast<CartesianPlot*>(QObject::sender());
1034 plot->shift(index, dim, leftOrDown);
1035 break;
1036 }
1037 }
1038}
1039
1040void Worksheet::cartesianPlotWheelEvent(const QPointF& sceneRelPos, int delta, int xIndex, int yIndex, bool considerDimension, Dimension dim) {
1041 const auto& plots = children<CartesianPlot>(AbstractAspect::ChildIndexFlag::Recursive | AbstractAspect::ChildIndexFlag::IncludeHidden);

Callers

nothing calls this directly

Calls 1

shiftMethod · 0.80

Tested by

no test coverage detected