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

Method handleCartesianPlotActions

src/frontend/worksheet/WorksheetView.cpp:2002–2075  ·  view source on GitHub ↗

check whether we have cartesian plots selected and activate/deactivate

Source from the content-addressed store, hash-verified

2000
2001// check whether we have cartesian plots selected and activate/deactivate
2002void WorksheetView::handleCartesianPlotActions() {
2003 if (!m_plotActionsInitialized)
2004 return;
2005
2006 if (m_mouseMode != MouseMode::Selection)
2007 return; // Do not change selection when the mousemode is not selection!
2008
2009 m_selectedElement = nullptr;
2010
2011 bool handled = false, plot = false;
2012 for (auto* item : m_selectedItems) {
2013 // TODO: or if a children of a plot is selected
2014 auto* w = static_cast<WorksheetElementPrivate*>(item)->q;
2015 if (w->type() == AspectType::CartesianPlot) {
2016 handled = true;
2017 plot = true;
2018 m_selectedElement = w;
2019 handleCartesianPlotSelected(static_cast<CartesianPlot*>(m_selectedElement));
2020 break;
2021 } else if (w->type() == AspectType::ReferenceLine) {
2022 handled = true;
2023 m_selectedElement = w;
2024 handleReferenceLineSelected();
2025 } else if (w->type() == AspectType::ReferenceRange) {
2026 handled = true;
2027 m_selectedElement = w;
2028 handleReferenceRangeSelected();
2029 } else if (w->type() == AspectType::Axis) {
2030 handled = true;
2031 m_selectedElement = w;
2032 handleAxisSelected(static_cast<Axis*>(m_selectedElement));
2033 break;
2034 } else if (dynamic_cast<Plot*>(w) || w->coordinateBindingEnabled()) {
2035 // Plot and other WorksheetElements like custompoint, infoelement, textlabel
2036 handled = true;
2037 m_selectedElement = w;
2038 handlePlotSelected();
2039 break;
2040 }
2041 }
2042
2043 if (!handled) {
2044 cartesianPlotZoomSelectionModeAction->setEnabled(false);
2045 cartesianPlotZoomSelectionModeAction->setChecked(false);
2046 cartesianPlotZoomXSelectionModeAction->setEnabled(false);
2047 cartesianPlotZoomXSelectionModeAction->setChecked(false);
2048 cartesianPlotZoomYSelectionModeAction->setEnabled(false);
2049 cartesianPlotZoomYSelectionModeAction->setChecked(false);
2050 for (auto* p : m_worksheet->children<CartesianPlot>())
2051 p->setMouseMode(CartesianPlot::MouseMode::Selection);
2052 zoomInAction->setEnabled(false);
2053 zoomOutAction->setEnabled(false);
2054 zoomInXAction->setEnabled(false);
2055 zoomOutXAction->setEnabled(false);
2056 zoomInYAction->setEnabled(false);
2057 zoomOutYAction->setEnabled(false);
2058 shiftLeftXAction->setEnabled(false);
2059 shiftRightXAction->setEnabled(false);

Callers

nothing calls this directly

Calls 3

setMouseModeMethod · 0.80
typeMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected