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

Method cartesianPlotWheelEvent

src/backend/worksheet/Worksheet.cpp:1040–1092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);
1042 const auto cursorMode = cartesianPlotActionMode();
1043 if (considerDimension) {
1044 if ((dim == Dimension::X && (cursorMode == CartesianPlotActionMode::ApplyActionToAllX || cursorMode == CartesianPlotActionMode::ApplyActionToAll))
1045 || (dim == Dimension::Y && (cursorMode == CartesianPlotActionMode::ApplyActionToAllY || cursorMode == CartesianPlotActionMode::ApplyActionToAll))) {
1046 for (auto* plot : plots)
1047 plot->wheelEvent(sceneRelPos, delta, -1, -1, considerDimension, dim);
1048 } else {
1049 auto* plot = static_cast<CartesianPlot*>(QObject::sender());
1050 plot->wheelEvent(sceneRelPos, delta, xIndex, yIndex, considerDimension, dim);
1051 }
1052
1053 } else {
1054 switch (cursorMode) {
1055 case CartesianPlotActionMode::ApplyActionToAll: {
1056 for (auto* plot : plots)
1057 plot->wheelEvent(sceneRelPos, delta, -1, -1, considerDimension, dim);
1058 break;
1059 }
1060 case CartesianPlotActionMode::ApplyActionToAllX: {
1061 auto* plot = static_cast<CartesianPlot*>(QObject::sender());
1062 plot->wheelEvent(sceneRelPos, delta, -1, yIndex, considerDimension, dim);
1063 for (auto* p : plots) {
1064 if (p != plot) {
1065 // The yIndex must not be available in the other plots
1066 // yIndex does not matter, because considerDimension is true
1067 p->wheelEvent(sceneRelPos, delta, -1, -1, true, Dimension::X);
1068 }
1069 }
1070 break;
1071 }
1072 case CartesianPlotActionMode::ApplyActionToAllY: {
1073 auto* plot = static_cast<CartesianPlot*>(QObject::sender());
1074 // wheelEvent on all y in that plot
1075 plot->wheelEvent(sceneRelPos, delta, xIndex, -1, considerDimension, dim);
1076 for (auto* p : plots) {
1077 if (p != plot) {
1078 // The xIndex must not be available in the other plots
1079 // xIndex does not matter, because considerDimension is true
1080 p->wheelEvent(sceneRelPos, delta, -1, -1, true, Dimension::Y);
1081 }
1082 }
1083 break;
1084 }
1085 case CartesianPlotActionMode::ApplyActionToSelection: {
1086 auto* plot = static_cast<CartesianPlot*>(QObject::sender());
1087 plot->wheelEvent(sceneRelPos, delta, xIndex, yIndex, considerDimension, dim);
1088 break;
1089 }
1090 }
1091 }
1092}
1093
1094void Worksheet::cartesianPlotMouseMoveCursorMode(int cursorNumber, QPointF logicPos) {
1095 if (cartesianPlotCursorMode() == CartesianPlotActionMode::ApplyActionToAll) {

Callers

nothing calls this directly

Calls 1

wheelEventMethod · 0.45

Tested by

no test coverage detected