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

Method initPlotNavigationActions

src/frontend/worksheet/WorksheetView.cpp:335–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333}
334
335void WorksheetView::initPlotNavigationActions() {
336 auto* plotMouseModeActionGroup = new QActionGroup(this);
337 plotMouseModeActionGroup->setExclusive(true);
338 cartesianPlotSelectionModeAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-cursor-arrow")), i18n("Select and Edit"), plotMouseModeActionGroup);
339 cartesianPlotSelectionModeAction->setData(static_cast<int>(CartesianPlot::MouseMode::Selection));
340 cartesianPlotSelectionModeAction->setCheckable(true);
341 cartesianPlotSelectionModeAction->setChecked(true);
342
343 cartesianPlotCrosshairModeAction = new QAction(QIcon::fromTheme(QStringLiteral("crosshairs")), i18n("Crosshair"), plotMouseModeActionGroup);
344 cartesianPlotCrosshairModeAction->setData(static_cast<int>(CartesianPlot::MouseMode::Crosshair));
345 cartesianPlotCrosshairModeAction->setCheckable(true);
346
347 cartesianPlotZoomSelectionModeAction =
348 new QAction(QIcon::fromTheme(QStringLiteral("labplot-zoom-select")), i18n("Select Region and Zoom In"), plotMouseModeActionGroup);
349 cartesianPlotZoomSelectionModeAction->setData(static_cast<int>(CartesianPlot::MouseMode::ZoomSelection));
350 cartesianPlotZoomSelectionModeAction->setCheckable(true);
351
352 cartesianPlotZoomXSelectionModeAction =
353 new QAction(QIcon::fromTheme(QStringLiteral("labplot-zoom-select-x")), i18n("Select X-Region and Zoom In"), plotMouseModeActionGroup);
354 cartesianPlotZoomXSelectionModeAction->setData(static_cast<int>(CartesianPlot::MouseMode::ZoomXSelection));
355 cartesianPlotZoomXSelectionModeAction->setCheckable(true);
356
357 cartesianPlotZoomYSelectionModeAction =
358 new QAction(QIcon::fromTheme(QStringLiteral("labplot-zoom-select-y")), i18n("Select Y-Region and Zoom In"), plotMouseModeActionGroup);
359 cartesianPlotZoomYSelectionModeAction->setData(static_cast<int>(CartesianPlot::MouseMode::ZoomYSelection));
360 cartesianPlotZoomYSelectionModeAction->setCheckable(true);
361
362 // TODO: change ICON
363 cartesianPlotCursorModeAction = new QAction(QIcon::fromTheme(QStringLiteral("debug-execute-from-cursor")), i18n("Cursor"), plotMouseModeActionGroup);
364 cartesianPlotCursorModeAction->setData(static_cast<int>(CartesianPlot::MouseMode::Cursor));
365 cartesianPlotCursorModeAction->setCheckable(true);
366
367 connect(plotMouseModeActionGroup, &QActionGroup::triggered, this, &WorksheetView::cartesianPlotMouseModeChanged);
368
369 auto* cartesianPlotNavigationGroup = new QActionGroup(this);
370 scaleAutoAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-auto-scale-all")), i18n("Auto Scale"), cartesianPlotNavigationGroup);
371 scaleAutoAction->setData(static_cast<int>(CartesianPlot::NavigationOperation::ScaleAuto));
372 scaleAutoAction->setShortcut(Qt::Key_1);
373
374 scaleAutoXAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-auto-scale-x")), i18n("Auto Scale X"), cartesianPlotNavigationGroup);
375 scaleAutoXAction->setData(static_cast<int>(CartesianPlot::NavigationOperation::ScaleAutoX));
376 scaleAutoXAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_X);
377
378 scaleAutoYAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-auto-scale-y")), i18n("Auto Scale Y"), cartesianPlotNavigationGroup);
379 scaleAutoYAction->setData(static_cast<int>(CartesianPlot::NavigationOperation::ScaleAutoY));
380 scaleAutoYAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Y);
381
382 zoomInAction = new QAction(QIcon::fromTheme(QStringLiteral("zoom-in")), i18n("Zoom In"), cartesianPlotNavigationGroup);
383 zoomInAction->setData(static_cast<int>(CartesianPlot::NavigationOperation::ZoomIn));
384 zoomInAction->setShortcut(Qt::Key_Plus);
385
386 zoomOutAction = new QAction(QIcon::fromTheme(QStringLiteral("zoom-out")), i18n("Zoom Out"), cartesianPlotNavigationGroup);
387 zoomOutAction->setData(static_cast<int>(CartesianPlot::NavigationOperation::ZoomOut));
388 zoomOutAction->setShortcut(Qt::Key_Minus);
389
390 zoomInXAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-zoom-in-x")), i18n("Zoom In X"), cartesianPlotNavigationGroup);
391 zoomInXAction->setData(static_cast<int>(CartesianPlot::NavigationOperation::ZoomInX));
392 zoomInXAction->setShortcut(Qt::Key_X);

Callers 1

PresenterWidgetMethod · 0.80

Calls 1

setDataMethod · 0.45

Tested by

no test coverage detected