Mantid
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | Public Attributes | 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. More...
 
void replaceWSClicked (const QString &propName)
 Replace WS button was clicked. More...
 

Public Member Functions

void addEnabledAndDisableLists (const QStringList &enabled, const QStringList &disabled)
 Sets the properties to force as enabled/disabled. More...
 
 AlgorithmPropertiesWidget (QWidget *parent=nullptr)
 Constructor. More...
 
Mantid::API::IAlgorithm_sptr getAlgorithm ()
 
QString getAlgorithmName () const
 
void hideOrDisableProperties (const QString &changedPropName="")
 Go through all the properties, and check their validators to determine whether they should be made disabled/invisible. More...
 
void initLayout ()
 Create the layout for this dialog. More...
 
void saveInput ()
 When closing or changing algorithm, this saves the input history to QSettings. More...
 
void setAlgorithm (const Mantid::API::IAlgorithm_sptr &algo)
 Directly set the algorithm to view. More...
 
void setAlgorithmName (QString name)
 Set the algorithm to view using its name. More...
 
void setInputHistory (MantidQt::API::AbstractAlgorithmInputHistory *inputHistory)
 Sets the AlgorithmInputHistoryImpl object holding all histories. More...
 
 ~AlgorithmPropertiesWidget () override
 Destructor. More...
 

Public Attributes

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

Properties

QString algorithmName
 

Private Member Functions

bool isWidgetEnabled (Mantid::Kernel::Property *property, const QString &propName) const
 Check if the control should be enabled for this property. More...
 

Private Attributes

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

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()

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.

◆ hideOrDisableProperties()

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

Go through all the properties, and check their validators to determine whether they should be made disabled/invisible.

It also shows/hids the validators. All properties' values should be set already, otherwise the validators will be running on old data.

Parameters
changedPropName:: name of the property that was changed

Definition at line 372 of file AlgorithmPropertiesWidget.cpp.

References Mantid::Kernel::IPropertySettings::applyChanges(), MantidQt::API::PropertyWidgetFactory::createWidget(), error, Mantid::Kernel::Property::getSettings(), Mantid::Kernel::IPropertySettings::isConditionChanged(), Mantid::Kernel::IPropertySettings::isVisible(), isWidgetEnabled(), m_algo, m_errors, 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 ( Mantid::Kernel::Property property,
const QString &  propName 
) const
private

Check if the control should be enabled for this property.

Parameters
property:: the property that allows to check for the settings.
propName:: The name of the property

The control is disabled if (1) It is contained in the disabled list or (2) A user passed a value into the dialog

Definition at line 337 of file AlgorithmPropertiesWidget.cpp.

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

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 272 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 287 of file AlgorithmPropertiesWidget.cpp.

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

Referenced by initLayout().

◆ saveInput()

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

When closing or changing algorithm, this saves the input history to QSettings.

Definition at line 439 of file AlgorithmPropertiesWidget.cpp.

References MantidQt::API::PropertyWidget::getValue(), m_algoName, m_inputHistory, m_propWidgets, MantidQt::API::AbstractAlgorithmInputHistory::storeNewValue(), and value.

Referenced by setAlgorithm().

◆ 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 Mantid::Kernel::SingletonHolder< T >::Instance(), m_algoName, 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.

Member Data Documentation

◆ m_algo

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

Pointer to the algorithm to view.

Definition at line 85 of file AlgorithmPropertiesWidget.h.

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

◆ m_algoName

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

Chosen algorithm name.

Definition at line 82 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 91 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 102 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 98 of file AlgorithmPropertiesWidget.h.

Referenced by addEnabledAndDisableLists(), and isWidgetEnabled().

◆ m_errors

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

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

it is not valid).

Definition at line 95 of file AlgorithmPropertiesWidget.h.

Referenced by hideOrDisableProperties().

◆ m_groupWidgets

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

Mapping between group and it's dynamically created widget.

Definition at line 63 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 88 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 105 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 69 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 66 of file AlgorithmPropertiesWidget.h.

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

Property Documentation

◆ algorithmName

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

Definition at line 35 of file AlgorithmPropertiesWidget.h.


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