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

Method cartesianPlotNavigationChanged

src/frontend/worksheet/WorksheetView.cpp:2479–2522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2477}
2478
2479void WorksheetView::cartesianPlotNavigationChanged(QAction* action) {
2480 // TODO: find out, which element was selected to find out which range should be changed
2481 // Project().projectExplorer().currentAspect()
2482
2483 auto op = (CartesianPlot::NavigationOperation)action->data().toInt();
2484 auto plotActionMode = m_worksheet->cartesianPlotActionMode();
2485 if (plotActionMode == Worksheet::CartesianPlotActionMode::ApplyActionToSelection) {
2486 int cSystemIndex = CartesianPlot::cSystemIndex(m_selectedElement);
2487 const auto& plots = m_worksheet->children<CartesianPlot>();
2488 for (auto* plot : plots) {
2489 if (m_selectedItems.indexOf(plot->graphicsItem()) != -1)
2490 plot->navigate(cSystemIndex, op);
2491 else {
2492 // check if one of the plots childrend is selected. Do the operation there too.
2493 for (auto* child : plot->children<WorksheetElement>()) {
2494 if (m_selectedItems.indexOf(child->graphicsItem()) != -1) {
2495 plot->navigate(cSystemIndex, op);
2496 break;
2497 }
2498 }
2499 }
2500 }
2501 } else if ((plotActionMode == Worksheet::CartesianPlotActionMode::ApplyActionToAllY
2502 && (op == CartesianPlot::NavigationOperation::ScaleAutoX || op == CartesianPlot::NavigationOperation::ShiftLeftX
2503 || op == CartesianPlot::NavigationOperation::ShiftRightX || op == CartesianPlot::NavigationOperation::ZoomInX
2504 || op == CartesianPlot::NavigationOperation::ZoomOutX))
2505 || (plotActionMode == Worksheet::CartesianPlotActionMode::ApplyActionToAllX
2506 && (op == CartesianPlot::NavigationOperation::ScaleAutoY || op == CartesianPlot::NavigationOperation::ShiftUpY
2507 || op == CartesianPlot::NavigationOperation::ShiftDownY || op == CartesianPlot::NavigationOperation::ZoomInY
2508 || op == CartesianPlot::NavigationOperation::ZoomOutY))) {
2509 int cSystemIndex = CartesianPlot::cSystemIndex(m_selectedElement);
2510 if (m_selectedElement->type() == AspectType::CartesianPlot)
2511 static_cast<CartesianPlot*>(m_selectedElement)->navigate(-1, op);
2512 else {
2513 auto parentPlot = static_cast<CartesianPlot*>(m_selectedElement->parent(AspectType::CartesianPlot));
2514 if (parentPlot) // really needed?
2515 parentPlot->navigate(cSystemIndex, op);
2516 }
2517 } else {
2518 const auto& plots = m_worksheet->children<CartesianPlot>();
2519 for (auto* plot : plots)
2520 plot->navigate(-1, op);
2521 }
2522}
2523
2524Worksheet::CartesianPlotActionMode WorksheetView::getCartesianPlotActionMode() const {
2525 return m_worksheet->cartesianPlotActionMode();

Callers 1

Calls 7

navigateMethod · 0.80
dataMethod · 0.45
indexOfMethod · 0.45
graphicsItemMethod · 0.45
typeMethod · 0.45
parentMethod · 0.45

Tested by 1