|
Mantid
|
Widget that contains dynamically generated PropertyWidget's for each property of an algorithm, contained in a scroll area. More...
#include <AlgorithmPropertiesWidget.h>
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::AbstractAlgorithmInputHistory * | m_inputHistory |
| History of inputs to the algorithm. | |
Widget that contains dynamically generated PropertyWidget's for each property of an algorithm, contained in a scroll area.
Definition at line 35 of file AlgorithmPropertiesWidget.h.
| 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.
|
overridedefault |
Destructor.
| 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().
| Mantid::API::IAlgorithm_sptr MantidQt::API::AlgorithmPropertiesWidget::getAlgorithm | ( | ) |
Definition at line 95 of file AlgorithmPropertiesWidget.cpp.
References m_algo.
Referenced by initLayout().
| const QString & MantidQt::API::AlgorithmPropertiesWidget::getAlgorithmName | ( | ) | const |
Definition at line 112 of file AlgorithmPropertiesWidget.cpp.
References m_algoName.
|
private |
Check 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().
| 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.
| 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().
| void MantidQt::API::AlgorithmPropertiesWidget::initLayout | ( | ) |
Create the layout for this dialog.
Definition at line 161 of file AlgorithmPropertiesWidget.cpp.
References MantidQt::API::PropertyWidget::addReplaceWSButton(), MantidQt::API::PropertyWidgetFactory::createWidget(), error, getAlgorithm(), group, hasInputWS(), m_algoName, m_currentGrid, m_groupWidgets, m_inputGrid, m_inputHistory, m_propWidgets, Mantid::Kernel::Direction::Output, MantidQt::API::AbstractAlgorithmInputHistory::previousInput(), propertyChanged(), replaceWSClicked(), MantidQt::API::PropertyWidget::setError(), MantidQt::API::PropertyWidget::setPrevious_isDynamicDefault(), and MantidQt::API::PropertyWidget::setPreviousValue().
Referenced by AlgorithmPropertiesWidget(), and setAlgorithm().
|
protected |
Check if the control should be enabled for this property.
| 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().
|
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).
| 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().
|
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.
| changedPropName | :: name of the property that was changed |
Definition at line 282 of file AlgorithmPropertiesWidget.cpp.
References hideOrDisableProperties().
Referenced by hideOrDisableProperties(), and initLayout().
|
slot |
Replace WS button was clicked.
A slot to handle the replace workspace button click.
| 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().
| void MantidQt::API::AlgorithmPropertiesWidget::saveInput | ( | ) |
When closing or changing algorithm, this saves the input history to QSettings.
Definition at line 451 of file AlgorithmPropertiesWidget.cpp.
References MantidQt::API::PropertyWidget::getProperty(), MantidQt::API::PropertyWidget::getValue(), m_algoName, m_inputHistory, m_propWidgets, MantidQt::API::AbstractAlgorithmInputHistory::storeNewValue(), and value.
Referenced by setAlgorithm().
| void MantidQt::API::AlgorithmPropertiesWidget::setAlgorithm | ( | const Mantid::API::IAlgorithm_sptr & | algo | ) |
Directly set the algorithm to view.
Sets the name to match
| 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().
| void MantidQt::API::AlgorithmPropertiesWidget::setAlgorithmName | ( | QString | name | ) |
Set the algorithm to view using its name.
| name | :: The algorithm name |
Definition at line 117 of file AlgorithmPropertiesWidget.cpp.
References m_algoName, name, and setAlgorithm().
| void MantidQt::API::AlgorithmPropertiesWidget::setInputHistory | ( | MantidQt::API::AbstractAlgorithmInputHistory * | inputHistory | ) |
Sets the AlgorithmInputHistoryImpl object holding all histories.
This object does NOT take ownership
| inputHistory | :: AlgorithmInputHistoryImpl ptr |
Definition at line 89 of file AlgorithmPropertiesWidget.cpp.
References m_inputHistory.
| 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().
|
private |
Pointer to the algorithm to view.
Definition at line 97 of file AlgorithmPropertiesWidget.h.
Referenced by getAlgorithm(), hideOrDisableProperties(), isWidgetEnabled(), isWidgetVisible(), and setAlgorithm().
|
private |
Chosen algorithm name.
Definition at line 94 of file AlgorithmPropertiesWidget.h.
Referenced by getAlgorithmName(), initLayout(), saveInput(), setAlgorithm(), and setAlgorithmName().
|
private |
The current grid widget for sub-boxes.
Definition at line 103 of file AlgorithmPropertiesWidget.h.
Referenced by initLayout().
|
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().
|
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().
|
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().
| 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().
|
private |
The grid widget containing the input boxes.
Definition at line 100 of file AlgorithmPropertiesWidget.h.
Referenced by AlgorithmPropertiesWidget(), and initLayout().
|
private |
History of inputs to the algorithm.
Definition at line 119 of file AlgorithmPropertiesWidget.h.
Referenced by initLayout(), saveInput(), and setInputHistory().
| QHash<QString, PropertyWidget *> MantidQt::API::AlgorithmPropertiesWidget::m_propWidgets |
Each dynamically created PropertyWidget.
Definition at line 62 of file AlgorithmPropertiesWidget.h.
Referenced by MantidQt::API::GenericDialog::accept(), SmoothNeighboursDialog::accept(), hideOrDisableProperties(), initLayout(), MantidQt::API::GenericDialog::initLayout(), SmoothNeighboursDialog::initLayout(), MantidQt::API::GenericDialog::parseInput(), replaceWSClicked(), and saveInput().
| 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().
| 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().
|
readwrite |
Definition at line 37 of file AlgorithmPropertiesWidget.h.