| 251 | } |
| 252 | |
| 253 | QMenu* XYCurve::createContextMenu() { |
| 254 | Q_D(const XYCurve); |
| 255 | if (!m_menusInitialized) |
| 256 | initActions(); |
| 257 | |
| 258 | QMenu* menu = WorksheetElement::createContextMenu(); |
| 259 | QAction* visibilityAction = this->visibilityAction(); // skip the first action because of the "title-action", second is visible |
| 260 | |
| 261 | //"data analysis" menu |
| 262 | menu->insertMenu(visibilityAction, d->m_plot->analysisMenu()); |
| 263 | menu->insertSeparator(visibilityAction); |
| 264 | |
| 265 | //"Navigate to spreadsheet"-action, show only if x- or y-columns have data from a spreadsheet |
| 266 | AbstractAspect* parentSpreadsheet = nullptr; |
| 267 | if (xColumn() && dynamic_cast<Spreadsheet*>(xColumn()->parentAspect())) |
| 268 | parentSpreadsheet = xColumn()->parentAspect(); |
| 269 | else if (yColumn() && dynamic_cast<Spreadsheet*>(yColumn()->parentAspect())) |
| 270 | parentSpreadsheet = yColumn()->parentAspect(); |
| 271 | |
| 272 | if (parentSpreadsheet) { |
| 273 | navigateToAction->setText(i18n("Navigate to \"%1\"", parentSpreadsheet->name())); |
| 274 | navigateToAction->setData(parentSpreadsheet->path()); |
| 275 | menu->insertAction(visibilityAction, navigateToAction); |
| 276 | menu->insertSeparator(visibilityAction); |
| 277 | } |
| 278 | |
| 279 | // if the context menu is called on an item that is not selected yet, select it |
| 280 | if (!graphicsItem()->isSelected()) |
| 281 | graphicsItem()->setSelected(true); |
| 282 | |
| 283 | return menu; |
| 284 | } |
| 285 | |
| 286 | /*! |
| 287 | Returns an icon to be used in the project explorer. |
nothing calls this directly
no test coverage detected