! * Populates the menu \c menu with the spreadsheet and spreadsheet view relevant actions. * The menu is used * - as the context menu in WorkbookView * - as the "spreadsheet menu" in the main menu-bar (called form MainWin) * - as a part of the spreadsheet context menu in project explorer */
| 123 | * - as a part of the spreadsheet context menu in project explorer |
| 124 | */ |
| 125 | void WorkbookView::createContextMenu(QMenu* menu) const { |
| 126 | Q_ASSERT(menu); |
| 127 | |
| 128 | QAction* firstAction = nullptr; |
| 129 | // if we're populating the context menu for the project explorer, then |
| 130 | // there're already actions available there. Skip the first title-action |
| 131 | // and insert the action at the beginning of the menu. |
| 132 | if (menu->actions().size() > 1) |
| 133 | firstAction = menu->actions().at(1); |
| 134 | |
| 135 | auto* addNewMenu = new QMenu(i18n("Add New"), const_cast<WorkbookView*>(this)); |
| 136 | addNewMenu->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); |
| 137 | addNewMenu->addAction(action_add_spreadsheet); |
| 138 | addNewMenu->addAction(action_add_matrix); |
| 139 | menu->insertMenu(firstAction, addNewMenu); |
| 140 | menu->insertSeparator(firstAction); |
| 141 | } |
| 142 | |
| 143 | void WorkbookView::showTabContextMenu(QPoint point) { |
| 144 | QMenu* menu = nullptr; |
no test coverage detected