24#include <QSignalMapper>
38 for (
size_t i = 0; i < numHist; ++i) {
39 if (ws.
y(i).size() > 1) {
52 m_plotBin(new QAction(
"Bin", this)), m_overplotSpectrum(new QAction(
"Overplot spectrum...", this)),
53 m_plotSpectrumWithErrs(new QAction(
"Spectrum with errors...", this)),
54 m_overplotSpectrumWithErrs(new QAction(
"Overplot spectrum with errors...", this)),
55 m_plotColorfill(new QAction(
"Colorfill", this)), m_sampleLogs(new QAction(
"Show Sample Logs", this)),
56 m_sliceViewer(new QAction(
"Show Slice Viewer", this)), m_showInstrument(new QAction(
"Show Instrument", this)),
57 m_showData(new QAction(
"Show Data", this)), m_showAlgorithmHistory(new QAction(
"Show History", this)),
58 m_showDetectors(new QAction(
"Show Detectors", this)), m_plotAdvanced(new QAction(
"Advanced...", this)),
59 m_plotSurface(new QAction(
"Surface", this)), m_plotWireframe(new QAction(
"Wireframe", this)),
60 m_plotContour(new QAction(
"Contour", this)), m_plotMDHisto1D(new QAction(
"Plot 1D MDHistogram...", this)),
61 m_overplotMDHisto1D(new QAction(
"Overplot 1D MDHistogram...", this)),
62 m_plotMDHisto1DWithErrs(new QAction(
"Plot 1D MDHistogram with errors...", this)),
63 m_overplotMDHisto1DWithErrs(new QAction(
"Overplot 1D MDHistogram with errors...", this)),
64 m_sampleMaterial(new QAction(
"Show Sample Material", this)),
65 m_sampleShape(new QAction(
"Show Sample Shape", this)), m_superplot(new QAction(
"Superplot...", this)),
66 m_superplotWithErrs(new QAction(
"Superplot with errors...", this)),
67 m_superplotBins(new QAction(
"Superplot bins...", this)),
68 m_superplotBinsWithErrs(new QAction(
"Superplot bins with errors...", this)),
69 m_showNewInstrumentView(new QAction(
"(Experimental) Show Instrument", this)) {
120 m_tree->selectionModel()->clear();
122 QMenu *menu(
nullptr);
138 menu->popup(QCursor::pos());
239 auto menu =
new QMenu(
this);
240 menu->setAttribute(Qt::WA_DeleteOnClose,
true);
241 menu->setObjectName(
"WorkspaceContextMenu");
266 menu->addSeparator();
275 if (
m_tree->selectedItems().size() == 1) {
282 !
workspace.detectorInfo().detectorIDs().empty());
298 bool addSliceViewer =
false;
299 bool add1DPlot =
false;
304 auto num_dims =
workspace.getNumNonIntegratedDims();
309 }
else if (num_dims > 1) {
312 addSliceViewer =
true;
315 addSliceViewer =
true;
318 if (addSliceViewer) {
320 }
else if (add1DPlot) {
321 auto *plotSubMenu =
new QMenu(
"Plot", menu);
326 menu->addMenu(plotSubMenu);
331 auto workspaces =
workspace.getAllItems();
332 bool containsMatrixWorkspace{
false};
333 bool containsPeaksWorkspace{
false};
334 for (
const auto &ws : workspaces) {
335 if (std::dynamic_pointer_cast<MatrixWorkspace>(ws)) {
336 containsMatrixWorkspace =
true;
338 }
else if (std::dynamic_pointer_cast<IPeaksWorkspace>(ws)) {
339 containsPeaksWorkspace =
true;
345 if (containsMatrixWorkspace) {
347 menu->addSeparator();
351 if (containsPeaksWorkspace) {
358 menu->addSeparator();
361 menu->addSeparator();
366 auto *plotSubMenu =
new QMenu(
"Plot", parent);
367 if (hasMultipleBins) {
375 plotSubMenu->addSeparator();
378 auto *plot3DSubMenu =
new QMenu(
"3D", plotSubMenu);
382 plotSubMenu->addMenu(plot3DSubMenu);
388 plotSubMenu->addSeparator();
IPeaksWorkspace_sptr workspace
Basic MD Workspace Abstract Class.
Interface to the class Mantid::DataObjects::PeaksWorkspace.
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
Base MatrixWorkspace Abstract Class.
virtual std::size_t blocksize() const =0
Returns the size of each block of data returned by the dataY accessors.
virtual std::size_t getNumberHistograms() const =0
Returns the number of histograms in the workspace.
size_t getNumDims() const override
const HistogramData::HistogramY & y(const size_t index) const
Class to hold a set of workspaces.
Base Workspace Abstract Class.
Exception for when an item is not found in a collection.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace