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

Method initActions

src/frontend/MainWin.cpp:602–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602void MainWin::initActions() {
603 // ******************** File-menu *******************************
604 // add some standard actions
605 m_newProjectAction = KStandardAction::openNew(
606 this,
607 [=]() {
608 newProject(true);
609 },
610 actionCollection());
611 m_openProjectAction = KStandardAction::open(this, static_cast<void (MainWin::*)()>(&MainWin::openProject), actionCollection());
612 m_recentProjectsAction = KStandardAction::openRecent(this, &MainWin::openRecentProject, actionCollection());
613 m_saveAction = KStandardAction::save(this, &MainWin::saveProject, actionCollection());
614 m_saveAsAction = KStandardAction::saveAs(this, &MainWin::saveProjectAs, actionCollection());
615 m_printAction = KStandardAction::print(this, &MainWin::print, actionCollection());
616 m_printPreviewAction = KStandardAction::printPreview(this, &MainWin::printPreview, actionCollection());
617
618 QAction* openExample = new QAction(i18n("&Open Example"), actionCollection());
619 openExample->setIcon(QIcon::fromTheme(QLatin1String("folder-documents")));
620 actionCollection()->addAction(QLatin1String("file_example_open"), openExample);
621 connect(openExample, &QAction::triggered, this, [=]() {
622 auto* dlg = new ExamplesDialog(this);
623 if (dlg->exec() == QDialog::Accepted) {
624 const auto& path = dlg->path();
625 if (!path.isEmpty())
626 openProject(path);
627 }
628 delete dlg;
629 });
630
631 m_fullScreenAction = KStandardAction::fullScreen(this, &MainWin::toggleFullScreen, this, actionCollection());
632
633 // QDEBUG(Q_FUNC_INFO << ", preferences action name:" << KStandardAction::name(KStandardAction::Preferences))
634 KStandardAction::preferences(this, &MainWin::settingsDialog, actionCollection());
635 // QAction* action = actionCollection()->action(KStandardAction::name(KStandardAction::Preferences)));
636 KStandardAction::quit(this, &MainWin::close, actionCollection());
637
638 // New Folder/Workbook/Spreadsheet/Matrix/Worksheet/Datasources
639 m_newWorkbookAction = new QAction(QIcon::fromTheme(QLatin1String("labplot-workbook-new")), i18n("Workbook"), this);
640 actionCollection()->addAction(QLatin1String("new_workbook"), m_newWorkbookAction);
641 m_newWorkbookAction->setWhatsThis(i18n("Creates a new workbook for collection spreadsheets, matrices and plots"));
642 connect(m_newWorkbookAction, &QAction::triggered, this, &MainWin::newWorkbook);
643
644 m_newDatapickerAction = new QAction(QIcon::fromTheme(QLatin1String("color-picker-black")), i18n("Data Extractor"), this);
645 m_newDatapickerAction->setWhatsThis(i18n("Creates a data extractor for getting data from a picture"));
646 actionCollection()->addAction(QLatin1String("new_datapicker"), m_newDatapickerAction);
647 connect(m_newDatapickerAction, &QAction::triggered, this, &MainWin::newDatapicker);
648
649 m_newSpreadsheetAction = new QAction(QIcon::fromTheme(QLatin1String("labplot-spreadsheet-new")), i18n("Spreadsheet"), this);
650 // m_newSpreadsheetAction->setShortcut(Qt::CTRL+Qt::Key_Equal);
651 m_newSpreadsheetAction->setWhatsThis(i18n("Creates a new spreadsheet for data editing"));
652 actionCollection()->addAction(QLatin1String("new_spreadsheet"), m_newSpreadsheetAction);
653 connect(m_newSpreadsheetAction, &QAction::triggered, this, &MainWin::newSpreadsheet);
654
655 m_newMatrixAction = new QAction(QIcon::fromTheme(QLatin1String("labplot-matrix-new")), i18n("Matrix"), this);
656 // m_newMatrixAction->setShortcut(Qt::CTRL+Qt::Key_Equal);
657 m_newMatrixAction->setWhatsThis(i18n("Creates a new matrix for data editing"));
658 actionCollection()->addAction(QLatin1String("new_matrix"), m_newMatrixAction);
659 connect(m_newMatrixAction, &QAction::triggered, this, &MainWin::newMatrix);

Calls 12

undoFunction · 0.85
groupFunction · 0.85
execMethod · 0.80
searchMethod · 0.80
QStringClass · 0.50
setIconMethod · 0.45
pathMethod · 0.45
isEmptyMethod · 0.45
iconMethod · 0.45
setDataMethod · 0.45
setEnabledMethod · 0.45
isVisibleMethod · 0.45