Mantid
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Public Attributes | Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
MantidQt::API::AlgorithmPropertiesWidget Class Reference

Widget that contains dynamically generated PropertyWidget's for each property of an algorithm, contained in a scroll area. More...

#include <AlgorithmPropertiesWidget.h>

Inheritance diagram for MantidQt::API::AlgorithmPropertiesWidget:

Public Slots

void propertyChanged (const QString &changedPropName)
 Any property changed.
 
void replaceWSClicked (const QString &propName)
 Replace WS button was clicked.
 

Public Member Functions

void addEnabledAndDisableLists (const QStringList &enabled, const QStringList &disabled)
 Sets the properties to force as enabled/disabled.
 
 AlgorithmPropertiesWidget (QWidget *parent=nullptr)
 Constructor.
 
Mantid::API::IAlgorithm_sptr getAlgorithm ()
 
const QString & getAlgorithmName () const
 
void hideOrDisableProperties (const QString &changedPropName="")
 Go through all the properties, and check their settings in order to implement any changes dependent on upstream properties.
 
void initLayout ()
 Create the layout for this dialog.
 
void saveInput ()
 When closing or changing algorithm, this saves the input history to QSettings.
 
void setAlgorithm (const Mantid::API::IAlgorithm_sptr &algo)
 Directly set the algorithm to view.
 
void setAlgorithmName (QString name)
 Set the algorithm to view using its name.
 
void setInputHistory (MantidQt::API::AbstractAlgorithmInputHistory *inputHistory)
 Sets the AlgorithmInputHistoryImpl object holding all histories.
 
void shareErrorsMap (const QHash< QString, QString > &errors)
 Share the errors map with the parent dialog.
 
 ~AlgorithmPropertiesWidget () override
 Destructor.
 

Public Attributes

QHash< QString, QGroupBox * > m_groupWidgets
 Mapping between group and it's dynamically created widget.
 
QHash< QString, PropertyWidget * > m_propWidgets
 Each dynamically created PropertyWidget.
 
QScrollArea * m_scroll
 Scroll area containing the viewport.
 
QWidget * m_viewport
 Viewport containing the grid of property widgets.
 

Protected Member Functions

bool isWidgetEnabled (const Mantid::Kernel::Property *prop) const
 Check if the control should be enabled for this property.
 
bool isWidgetVisible (const Mantid::Kernel::Property *prop) const
 Compute if the control should be visible for this property based on settings and error state.
 

Properties

QString algorithmName
 

Private Member Functions

bool hasInputWS (const std::vector< Mantid::Kernel::Property * > &prop_list) const
 Check if there is any input workspace in the properties list.
 

Private Attributes

Mantid::API::IAlgorithm_sptr m_algo
 Pointer to the algorithm to view.
 
QString m_algoName
 Chosen algorithm name.
 
QGridLayout * m_currentGrid
 The current grid widget for sub-boxes.
 
QStringList m_disabled
 A list of property names that are FORCED to stay disabled.
 
QStringList m_enabled
 A list of property names that are FORCED to stay enabled.
 
QHash< QString, QString > const * m_errors
 A map where key = property name; value = any error for this property (i.e.
 
QGridLayout * m_inputGrid
 The grid widget containing the input boxes.
 
MantidQt::API::AbstractAlgorithmInputHistorym_inputHistory
 History of inputs to the algorithm.
 

Detailed Description

Widget that contains dynamically generated PropertyWidget's for each property of an algorithm, contained in a scroll area.

Date
2012-03-09

Definition at line 35 of file AlgorithmPropertiesWidget.h.

Constructor & Destructor Documentation

◆ AlgorithmPropertiesWidget()

MantidQt::API::AlgorithmPropertiesWidget::AlgorithmPropertiesWidget ( QWidget *  parent = nullptr)

Constructor.

Definition at line 40 of file AlgorithmPropertiesWidget.cpp.

References initLayout(), m_inputGrid, m_scroll, and m_viewport.

◆ ~AlgorithmPropertiesWidget()

MantidQt::API::AlgorithmPropertiesWidget::~AlgorithmPropertiesWidget ( )
overridedefault

Destructor.

Member Function Documentation

◆ addEnabledAndDisableLists()

void MantidQt::API::AlgorithmPropertiesWidget::addEnabledAndDisableLists ( const QStringList &  enabled,
const QStringList &  disabled 
)

Sets the properties to force as enabled/disabled.

Definition at line 132 of file AlgorithmPropertiesWidget.cpp.

References m_disabled, and m_enabled.

Referenced by MantidQt::API::GenericDialog::initLayout(), and SmoothNeighboursDialog::initLayout().

◆ getAlgorithm()

Mantid::API::IAlgorithm_sptr MantidQt::API::AlgorithmPropertiesWidget::getAlgorithm ( )
Returns
the algorithm being viewed

Definition at line 95 of file AlgorithmPropertiesWidget.cpp.

References m_algo.

Referenced by initLayout().

◆ getAlgorithmName()

const QString & MantidQt::API::AlgorithmPropertiesWidget::getAlgorithmName ( ) const
Returns
the name of the algorithm being displayed

Definition at line 112 of file AlgorithmPropertiesWidget.cpp.

References m_algoName.

◆ hasInputWS()

bool MantidQt::API::AlgorithmPropertiesWidget::hasInputWS ( const std::vector< Mantid::Kernel::Property * > &  prop_list) const
private

Check if there is any input workspace in the properties list.

Returns
true if there is any input workspace in the properties list

Definition at line 143 of file AlgorithmPropertiesWidget.cpp.

References Mantid::Kernel::Property::direction(), and Mantid::Kernel::Direction::Input.

Referenced by initLayout().

◆ hideOrDisableProperties()

void MantidQt::API::AlgorithmPropertiesWidget::hideOrDisableProperties ( const QString &  changedPropName = "")

Go through all the properties, and check their settings in order to implement any changes dependent on upstream properties.

Then, once any changes have been applied, go through settings and validators again to determine whether properties will be hidden or disabled. At entry to this method: all properties' values must be current.

Parameters
changedPropName:: name of the property that was changed

Definition at line 391 of file AlgorithmPropertiesWidget.cpp.

References MantidQt::API::PropertyWidgetFactory::createWidget(), Mantid::Kernel::Property::getSettings(), isWidgetEnabled(), isWidgetVisible(), m_algo, m_propWidgets, Mantid::Kernel::Property::name(), and propertyChanged().

Referenced by MantidQt::API::GenericDialog::initLayout(), SmoothNeighboursDialog::initLayout(), and propertyChanged().

◆ initLayout()

void MantidQt::API::AlgorithmPropertiesWidget::initLayout ( )

◆ isWidgetEnabled()

bool MantidQt::API::AlgorithmPropertiesWidget::isWidgetEnabled ( const Mantid::Kernel::Property prop) const
protected

Check if the control should be enabled for this property.

Parameters
prop:: the property to check

The control is disabled if (1) It is contained in the disabled list or (2) the property's settings chain indicates it should be disabled.

Definition at line 345 of file AlgorithmPropertiesWidget.cpp.

References m_algo, m_disabled, m_enabled, and Mantid::Kernel::Property::name().

Referenced by hideOrDisableProperties().

◆ isWidgetVisible()

bool MantidQt::API::AlgorithmPropertiesWidget::isWidgetVisible ( const Mantid::Kernel::Property prop) const
protected

Compute if the control should be visible for this property based on settings and error state.

WARNING: the GUI itself may override this visibility setting (e.g. if a parent widget is hidden).

Parameters
prop:: the property that allows to check for the settings.

Definition at line 369 of file AlgorithmPropertiesWidget.cpp.

References m_algo, m_errors, and Mantid::Kernel::Property::name().

Referenced by hideOrDisableProperties().

◆ propertyChanged

void MantidQt::API::AlgorithmPropertiesWidget::propertyChanged ( const QString &  changedPropName)
slot

Any property changed.

SLOT to be called whenever a property's value has just been changed and the widget has lost focus/value has been changed.

Parameters
changedPropName:: name of the property that was changed

Definition at line 282 of file AlgorithmPropertiesWidget.cpp.

References hideOrDisableProperties().

Referenced by hideOrDisableProperties(), and initLayout().

◆ replaceWSClicked

void MantidQt::API::AlgorithmPropertiesWidget::replaceWSClicked ( const QString &  propName)
slot

Replace WS button was clicked.

A slot to handle the replace workspace button click.

Parameters
propName:: the property for which we clicked "Replace Workspace"

Definition at line 297 of file AlgorithmPropertiesWidget.cpp.

References Mantid::Kernel::Property::direction(), MantidQt::API::PropertyWidget::getValue(), Mantid::Kernel::Direction::Input, MantidQt::API::isCalledInputWorkspaceOrLHSWorkspace(), m_propWidgets, MantidQt::API::PropertyWidget::setValue(), MantidQt::API::PropertyWidget::userEditedProperty(), and Mantid::Kernel::Property::value().

Referenced by initLayout().

◆ saveInput()

void MantidQt::API::AlgorithmPropertiesWidget::saveInput ( )

◆ setAlgorithm()

void MantidQt::API::AlgorithmPropertiesWidget::setAlgorithm ( const Mantid::API::IAlgorithm_sptr algo)

Directly set the algorithm to view.

Sets the name to match

Parameters
algo:: IAlgorithm bare ptr

Definition at line 101 of file AlgorithmPropertiesWidget.cpp.

References initLayout(), m_algo, m_algoName, and saveInput().

Referenced by MantidQt::API::GenericDialog::initLayout(), SmoothNeighboursDialog::initLayout(), and setAlgorithmName().

◆ setAlgorithmName()

void MantidQt::API::AlgorithmPropertiesWidget::setAlgorithmName ( QString  name)

Set the algorithm to view using its name.

Parameters
name:: The algorithm name

Definition at line 117 of file AlgorithmPropertiesWidget.cpp.

References m_algoName, name, and setAlgorithm().

◆ setInputHistory()

void MantidQt::API::AlgorithmPropertiesWidget::setInputHistory ( MantidQt::API::AbstractAlgorithmInputHistory inputHistory)

Sets the AlgorithmInputHistoryImpl object holding all histories.

This object does NOT take ownership

Parameters
inputHistory:: AlgorithmInputHistoryImpl ptr

Definition at line 89 of file AlgorithmPropertiesWidget.cpp.

References m_inputHistory.

◆ shareErrorsMap()

void MantidQt::API::AlgorithmPropertiesWidget::shareErrorsMap ( const QHash< QString, QString > &  errors)

Share the errors map with the parent dialog.

Definition at line 139 of file AlgorithmPropertiesWidget.cpp.

References m_errors.

Referenced by MantidQt::API::GenericDialog::initLayout().

Member Data Documentation

◆ m_algo

Mantid::API::IAlgorithm_sptr MantidQt::API::AlgorithmPropertiesWidget::m_algo
private

Pointer to the algorithm to view.

Definition at line 97 of file AlgorithmPropertiesWidget.h.

Referenced by getAlgorithm(), hideOrDisableProperties(), isWidgetEnabled(), isWidgetVisible(), and setAlgorithm().

◆ m_algoName

QString MantidQt::API::AlgorithmPropertiesWidget::m_algoName
private

Chosen algorithm name.

Definition at line 94 of file AlgorithmPropertiesWidget.h.

Referenced by getAlgorithmName(), initLayout(), saveInput(), setAlgorithm(), and setAlgorithmName().

◆ m_currentGrid

QGridLayout* MantidQt::API::AlgorithmPropertiesWidget::m_currentGrid
private

The current grid widget for sub-boxes.

Definition at line 103 of file AlgorithmPropertiesWidget.h.

Referenced by initLayout().

◆ m_disabled

QStringList MantidQt::API::AlgorithmPropertiesWidget::m_disabled
private

A list of property names that are FORCED to stay disabled.

e.g. when callid AlgorithmNameDialog()

Definition at line 116 of file AlgorithmPropertiesWidget.h.

Referenced by addEnabledAndDisableLists(), and isWidgetEnabled().

◆ m_enabled

QStringList MantidQt::API::AlgorithmPropertiesWidget::m_enabled
private

A list of property names that are FORCED to stay enabled.

Definition at line 112 of file AlgorithmPropertiesWidget.h.

Referenced by addEnabledAndDisableLists(), and isWidgetEnabled().

◆ m_errors

QHash<QString, QString> const* MantidQt::API::AlgorithmPropertiesWidget::m_errors
private

A map where key = property name; value = any error for this property (i.e.

it is not valid).

Definition at line 109 of file AlgorithmPropertiesWidget.h.

Referenced by isWidgetVisible(), and shareErrorsMap().

◆ m_groupWidgets

QHash<QString, QGroupBox *> MantidQt::API::AlgorithmPropertiesWidget::m_groupWidgets

Mapping between group and it's dynamically created widget.

Definition at line 65 of file AlgorithmPropertiesWidget.h.

Referenced by initLayout(), and SmoothNeighboursDialog::inputWorkspaceChanged().

◆ m_inputGrid

QGridLayout* MantidQt::API::AlgorithmPropertiesWidget::m_inputGrid
private

The grid widget containing the input boxes.

Definition at line 100 of file AlgorithmPropertiesWidget.h.

Referenced by AlgorithmPropertiesWidget(), and initLayout().

◆ m_inputHistory

MantidQt::API::AbstractAlgorithmInputHistory* MantidQt::API::AlgorithmPropertiesWidget::m_inputHistory
private

History of inputs to the algorithm.

Definition at line 119 of file AlgorithmPropertiesWidget.h.

Referenced by initLayout(), saveInput(), and setInputHistory().

◆ m_propWidgets

QHash<QString, PropertyWidget *> MantidQt::API::AlgorithmPropertiesWidget::m_propWidgets

◆ m_scroll

QScrollArea* MantidQt::API::AlgorithmPropertiesWidget::m_scroll

Scroll area containing the viewport.

Definition at line 71 of file AlgorithmPropertiesWidget.h.

Referenced by AlgorithmPropertiesWidget(), and MantidQt::API::GenericDialog::initLayout().

◆ m_viewport

QWidget* MantidQt::API::AlgorithmPropertiesWidget::m_viewport

Viewport containing the grid of property widgets.

Definition at line 68 of file AlgorithmPropertiesWidget.h.

Referenced by AlgorithmPropertiesWidget(), and MantidQt::API::GenericDialog::initLayout().

Property Documentation

◆ algorithmName

QString MantidQt::API::AlgorithmPropertiesWidget::algorithmName
readwrite

Definition at line 37 of file AlgorithmPropertiesWidget.h.


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