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

Method fillColumnContextMenu

src/frontend/notebook/NotebookView.cpp:281–308  ·  view source on GitHub ↗

! * adds column specific actions in SpreadsheetView to the context menu shown in the project explorer. */

Source from the content-addressed store, hash-verified

279 * adds column specific actions in SpreadsheetView to the context menu shown in the project explorer.
280 */
281void 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
310void NotebookView::fillToolBar(QToolBar* toolbar) {
311 if (!m_part)

Callers

nothing calls this directly

Calls 3

isPlottableMethod · 0.80
hasValuesMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected