! * adds column specific actions in SpreadsheetView to the context menu shown in the project explorer. */
| 279 | * adds column specific actions in SpreadsheetView to the context menu shown in the project explorer. |
| 280 | */ |
| 281 | void NotebookView::fillColumnContextMenu(QMenu* menu, Column* column) { |
| 282 | if (!column) |
| 283 | return; // should never happen, since the sender is always a Column |
| 284 | |
| 285 | m_contextMenuColumn = column; |
| 286 | |
| 287 | if (!m_plotDataMenu) { |
| 288 | auto* plotDataActionGroup = new QActionGroup(this); |
| 289 | connect(plotDataActionGroup, &QActionGroup::triggered, this, &NotebookView::plotData); |
| 290 | m_plotDataMenu = new QMenu(i18n("Plot Data"), this); |
| 291 | CartesianPlot::fillAddNewPlotMenu(m_plotDataMenu, plotDataActionGroup); |
| 292 | |
| 293 | m_statisticsAction = new QAction(QIcon::fromTheme(QStringLiteral("view-statistics")), i18n("Variable Statistics..."), this); |
| 294 | connect(m_statisticsAction, &QAction::triggered, this, &NotebookView::showStatistics); |
| 295 | } |
| 296 | |
| 297 | const bool hasValues = column->hasValues(); |
| 298 | const bool plottable = column->isPlottable(); |
| 299 | |
| 300 | QAction* firstAction = menu->actions().at(1); |
| 301 | menu->insertMenu(firstAction, m_plotDataMenu); |
| 302 | menu->insertSeparator(firstAction); |
| 303 | m_plotDataMenu->setEnabled(plottable && hasValues); |
| 304 | |
| 305 | menu->insertSeparator(firstAction); |
| 306 | menu->insertAction(firstAction, m_statisticsAction); |
| 307 | m_statisticsAction->setEnabled(hasValues); |
| 308 | } |
| 309 | |
| 310 | void NotebookView::fillToolBar(QToolBar* toolbar) { |
| 311 | if (!m_part) |
nothing calls this directly
no test coverage detected