Mantid
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | List of all members
MantidQt::MantidWidgets::MantidTreeWidget Class Reference

#include <MantidTreeWidget.h>

Inheritance diagram for MantidQt::MantidWidgets::MantidTreeWidget:

Public Member Functions

MantidWSIndexWidget::UserInput chooseSpectrumFromSelected (bool showWaterfallOpt=true, bool showPlotAll=true, bool showTiledOpt=true, bool isAdvanced=false) const
 Allows users to choose spectra from the selected workspaces by presenting them with a dialog box. More...
 
void disableNodes (bool)
 
void dropEvent (QDropEvent *de) override
 Accept a drag drop event and process the data appropriately. More...
 
QList< std::shared_ptr< const Mantid::API::MatrixWorkspace > > getSelectedMatrixWorkspaces () const
 Filter the list of selected workspace names to account for any non-MatrixWorkspaces that may have been selected. More...
 
QStringList getSelectedWorkspaceNames () const
 Returns a list of all selected workspaces. More...
 
Qt::SortOrder getSortOrder () const
 
MantidItemSortScheme getSortScheme () const
 
void logWarningMessage (const std::string &)
 Log a warning message. More...
 
 MantidTreeWidget (MantidDisplayBase *mui, QWidget *parent=nullptr)
 
void mouseDoubleClickEvent (QMouseEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void mousePressEvent (QMouseEvent *e) override
 
void setSortOrder (Qt::SortOrder)
 
void setSortScheme (MantidItemSortScheme)
 
void sort ()
 Sort the items according to the current sort scheme and order. More...
 

Public Attributes

std::function< void(QString)> m_doubleClickAction = nullptr
 Action that is executed when a workspace in the tree is double clicked. More...
 

Protected Member Functions

void dragEnterEvent (QDragEnterEvent *de) override
 Accept a drag enter event and selects whether to accept the action. More...
 
void dragMoveEvent (QDragMoveEvent *de) override
 Accept a drag move event and selects whether to accept the action. More...
 

Private Attributes

Mantid::API::AnalysisDataServiceImplm_ads
 
QPoint m_dragStartPosition
 
MantidDisplayBasem_mantidUI
 
Qt::SortOrder m_sortOrder
 
MantidItemSortScheme m_sortScheme
 

Detailed Description

Definition at line 24 of file MantidTreeWidget.h.

Constructor & Destructor Documentation

◆ MantidTreeWidget()

MantidQt::MantidWidgets::MantidTreeWidget::MantidTreeWidget ( MantidDisplayBase mui,
QWidget *  parent = nullptr 
)

Member Function Documentation

◆ chooseSpectrumFromSelected()

MantidWSIndexWidget::UserInput MantidQt::MantidWidgets::MantidTreeWidget::chooseSpectrumFromSelected ( bool  showWaterfallOpt = true,
bool  showPlotAll = true,
bool  showTiledOpt = true,
bool  isAdvanced = false 
) const

Allows users to choose spectra from the selected workspaces by presenting them with a dialog box.

Skips showing the dialog box and automatically chooses workspace index 0 for all selected workspaces if one or more of the them are single-spectrum workspaces.

Parameters
showWaterfallOptIf true, show the waterfall option on the dialog
showPlotAll:: [input] If true, show the "Plot All" button on the dialog
showTiledOpt:: [input] If true, show the "Tiled" option on the dialog
isAdvanced:: [input] If true, advanced plotting being done
Returns
:: A MantidWSIndexDialog::UserInput structure listing the selected options

Definition at line 215 of file MantidTreeWidget.cpp.

References MantidQt::MantidWidgets::MantidWSIndexWidget::UserInput::contour, MantidQt::MantidWidgets::MantidDisplayBase::createWorkspaceIndexDialog(), getSelectedMatrixWorkspaces(), MantidQt::MantidWidgets::MantidWSIndexDialog::getSelections(), m_mantidUI, MantidQt::MantidWidgets::MantidWSIndexWidget::UserInput::plots, MantidQt::MantidWidgets::MantidWSIndexWidget::UserInput::simple, MantidQt::MantidWidgets::MantidWSIndexWidget::UserInput::surface, MantidQt::MantidWidgets::MantidWSIndexWidget::UserInput::tiled, and MantidQt::MantidWidgets::MantidWSIndexWidget::UserInput::waterfall.

Referenced by MantidQt::MantidWidgets::WorkspaceTreeWidget::plotSpectrum().

◆ disableNodes()

void MantidQt::MantidWidgets::MantidTreeWidget::disableNodes ( bool  )

◆ dragEnterEvent()

void MantidQt::MantidWidgets::MantidTreeWidget::dragEnterEvent ( QDragEnterEvent *  de)
overrideprotected

Accept a drag enter event and selects whether to accept the action.

Parameters
de:: The drag enter event

Definition at line 55 of file MantidTreeWidget.cpp.

◆ dragMoveEvent()

void MantidQt::MantidWidgets::MantidTreeWidget::dragMoveEvent ( QDragMoveEvent *  de)
overrideprotected

Accept a drag move event and selects whether to accept the action.

Parameters
de:: The drag move event

Definition at line 45 of file MantidTreeWidget.cpp.

◆ dropEvent()

void MantidQt::MantidWidgets::MantidTreeWidget::dropEvent ( QDropEvent *  de)
override

◆ getSelectedMatrixWorkspaces()

QList< MatrixWorkspace_const_sptr > MantidQt::MantidWidgets::MantidTreeWidget::getSelectedMatrixWorkspaces ( ) const

Filter the list of selected workspace names to account for any non-MatrixWorkspaces that may have been selected.

In particular WorkspaceGroups (the children of which are to be included if they are MatrixWorkspaces) and TableWorkspaces (which are implicitly excluded). We only want workspaces we can actually plot!

Definition at line 165 of file MantidTreeWidget.cpp.

References getSelectedWorkspaceNames(), m_ads, and Mantid::Kernel::DataService< T >::retrieve().

Referenced by chooseSpectrumFromSelected().

◆ getSelectedWorkspaceNames()

QStringList MantidQt::MantidWidgets::MantidTreeWidget::getSelectedWorkspaceNames ( ) const

Returns a list of all selected workspaces.

It does NOT extract child workspaces from groups - it only returns exactly what has been selected.

Definition at line 147 of file MantidTreeWidget.cpp.

Referenced by getSelectedMatrixWorkspaces(), mouseDoubleClickEvent(), and mouseMoveEvent().

◆ getSortOrder()

Qt::SortOrder MantidQt::MantidWidgets::MantidTreeWidget::getSortOrder ( ) const

◆ getSortScheme()

MantidItemSortScheme MantidQt::MantidWidgets::MantidTreeWidget::getSortScheme ( ) const

◆ logWarningMessage()

void MantidQt::MantidWidgets::MantidTreeWidget::logWarningMessage ( const std::string &  msg)

Log a warning message.

Parameters
msg:: A message to log.

Definition at line 278 of file MantidTreeWidget.cpp.

Referenced by MantidQt::MantidWidgets::MantidTreeWidgetItem::operator<().

◆ mouseDoubleClickEvent()

void MantidQt::MantidWidgets::MantidTreeWidget::mouseDoubleClickEvent ( QMouseEvent *  e)
override

◆ mouseMoveEvent()

void MantidQt::MantidWidgets::MantidTreeWidget::mouseMoveEvent ( QMouseEvent *  e)
override

Definition at line 101 of file MantidTreeWidget.cpp.

References getSelectedWorkspaceNames(), and m_dragStartPosition.

◆ mousePressEvent()

void MantidQt::MantidWidgets::MantidTreeWidget::mousePressEvent ( QMouseEvent *  e)
override

Definition at line 91 of file MantidTreeWidget.cpp.

References m_dragStartPosition.

◆ setSortOrder()

void MantidQt::MantidWidgets::MantidTreeWidget::setSortOrder ( Qt::SortOrder  sortOrder)

◆ setSortScheme()

void MantidQt::MantidWidgets::MantidTreeWidget::setSortScheme ( MantidItemSortScheme  sortScheme)

◆ sort()

void MantidQt::MantidWidgets::MantidTreeWidget::sort ( )

Sort the items according to the current sort scheme and order.

Definition at line 272 of file MantidTreeWidget.cpp.

References m_sortOrder.

Referenced by MantidQt::MantidWidgets::WorkspaceTreeWidget::handleUpdateTree(), and MantidQt::MantidWidgets::WorkspaceTreeWidget::sortWorkspaces().

Member Data Documentation

◆ m_ads

Mantid::API::AnalysisDataServiceImpl& MantidQt::MantidWidgets::MantidTreeWidget::m_ads
private

Definition at line 56 of file MantidTreeWidget.h.

Referenced by getSelectedMatrixWorkspaces(), and mouseDoubleClickEvent().

◆ m_doubleClickAction

std::function<void(QString)> MantidQt::MantidWidgets::MantidTreeWidget::m_doubleClickAction = nullptr

Action that is executed when a workspace in the tree is double clicked.

Definition at line 47 of file MantidTreeWidget.h.

Referenced by MantidTreeWidget(), mouseDoubleClickEvent(), and MantidQt::MantidWidgets::WorkspaceTreeWidgetSimple::WorkspaceTreeWidgetSimple().

◆ m_dragStartPosition

QPoint MantidQt::MantidWidgets::MantidTreeWidget::m_dragStartPosition
private

Definition at line 54 of file MantidTreeWidget.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

◆ m_mantidUI

MantidDisplayBase* MantidQt::MantidWidgets::MantidTreeWidget::m_mantidUI
private

Definition at line 55 of file MantidTreeWidget.h.

Referenced by chooseSpectrumFromSelected(), dropEvent(), and MantidTreeWidget().

◆ m_sortOrder

Qt::SortOrder MantidQt::MantidWidgets::MantidTreeWidget::m_sortOrder
private

Definition at line 58 of file MantidTreeWidget.h.

Referenced by getSortOrder(), setSortOrder(), and sort().

◆ m_sortScheme

MantidItemSortScheme MantidQt::MantidWidgets::MantidTreeWidget::m_sortScheme
private

Definition at line 57 of file MantidTreeWidget.h.

Referenced by getSortScheme(), and setSortScheme().


The documentation for this class was generated from the following files: