| 179 | } |
| 180 | |
| 181 | QMenu* Histogram::createContextMenu() { |
| 182 | Q_D(const Histogram); |
| 183 | QMenu* menu = WorksheetElement::createContextMenu(); |
| 184 | QAction* visibilityAction = this->visibilityAction(); |
| 185 | |
| 186 | //"data analysis" menu |
| 187 | auto* analysisMenu = new QMenu(i18n("Analysis")); |
| 188 | |
| 189 | // TODO: if there are more actions, add a group for all fit types |
| 190 | auto* fitGaussianAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-xy-fit-curve")), i18n("Fit Gaussian (Normal) Distribution")); |
| 191 | analysisMenu->addAction(fitGaussianAction); |
| 192 | connect(fitGaussianAction, &QAction::triggered, this, [=]() { |
| 193 | d->m_plot->addHistogramFit(this, nsl_sf_stats_gaussian); |
| 194 | }); |
| 195 | |
| 196 | auto* fitExponentialAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-xy-fit-curve")), i18n("Fit Exponential Distribution")); |
| 197 | analysisMenu->addAction(fitExponentialAction); |
| 198 | connect(fitExponentialAction, &QAction::triggered, this, [=]() { |
| 199 | d->m_plot->addHistogramFit(this, nsl_sf_stats_exponential); |
| 200 | }); |
| 201 | |
| 202 | auto* fitLaplaceAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-xy-fit-curve")), i18n("Fit Laplace Distribution")); |
| 203 | analysisMenu->addAction(fitLaplaceAction); |
| 204 | connect(fitLaplaceAction, &QAction::triggered, this, [=]() { |
| 205 | d->m_plot->addHistogramFit(this, nsl_sf_stats_laplace); |
| 206 | }); |
| 207 | |
| 208 | auto* fitCauchyAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-xy-fit-curve")), i18n("Fit Cauchy-Lorentz Distribution")); |
| 209 | analysisMenu->addAction(fitCauchyAction); |
| 210 | connect(fitCauchyAction, &QAction::triggered, this, [=]() { |
| 211 | d->m_plot->addHistogramFit(this, nsl_sf_stats_cauchy_lorentz); |
| 212 | }); |
| 213 | |
| 214 | auto* fitLognormalAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-xy-fit-curve")), i18n("Fit Log-normal Distribution")); |
| 215 | analysisMenu->addAction(fitLognormalAction); |
| 216 | connect(fitLognormalAction, &QAction::triggered, this, [=]() { |
| 217 | d->m_plot->addHistogramFit(this, nsl_sf_stats_lognormal); |
| 218 | }); |
| 219 | |
| 220 | auto* fitPoissonAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-xy-fit-curve")), i18n("Fit Poisson Distribution")); |
| 221 | analysisMenu->addAction(fitPoissonAction); |
| 222 | connect(fitPoissonAction, &QAction::triggered, this, [=]() { |
| 223 | d->m_plot->addHistogramFit(this, nsl_sf_stats_poisson); |
| 224 | }); |
| 225 | |
| 226 | auto* fitBinomialAction = new QAction(QIcon::fromTheme(QStringLiteral("labplot-xy-fit-curve")), i18n("Fit Binomial Distribution")); |
| 227 | analysisMenu->addAction(fitBinomialAction); |
| 228 | connect(fitBinomialAction, &QAction::triggered, this, [=]() { |
| 229 | d->m_plot->addHistogramFit(this, nsl_sf_stats_binomial); |
| 230 | }); |
| 231 | |
| 232 | menu->insertMenu(visibilityAction, analysisMenu); |
| 233 | menu->insertSeparator(visibilityAction); |
| 234 | |
| 235 | return menu; |
| 236 | } |
| 237 | |
| 238 | /*! |
nothing calls this directly
no test coverage detected