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. 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::AbstractAlgorithmInputHistory * | m_inputHistory |
History of inputs to the algorithm. More... | |
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().
QString MantidQt::API::AlgorithmPropertiesWidget::getAlgorithmName | ( | ) | const |
Definition at line 112 of file AlgorithmPropertiesWidget.cpp.
References m_algoName.
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.
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().
void MantidQt::API::AlgorithmPropertiesWidget::initLayout | ( | ) |
Create the layout for this dialog.
Definition at line 159 of file AlgorithmPropertiesWidget.cpp.
References MantidQt::API::PropertyWidget::addReplaceWSButton(), MantidQt::API::PropertyWidgetFactory::createWidget(), error, getAlgorithm(), MantidQt::API::haveInputWS(), 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(), and MantidQt::API::PropertyWidget::setPreviousValue().
Referenced by AlgorithmPropertiesWidget(), and setAlgorithm().
|
private |
Check if the control should be enabled for this property.
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().
|
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 272 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 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().
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().
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 Mantid::Kernel::SingletonHolder< T >::Instance(), m_algoName, 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.
|
private |
Pointer to the algorithm to view.
Definition at line 85 of file AlgorithmPropertiesWidget.h.
Referenced by getAlgorithm(), hideOrDisableProperties(), isWidgetEnabled(), and setAlgorithm().
|
private |
Chosen algorithm name.
Definition at line 82 of file AlgorithmPropertiesWidget.h.
Referenced by getAlgorithmName(), initLayout(), saveInput(), setAlgorithm(), and setAlgorithmName().
|
private |
The current grid widget for sub-boxes.
Definition at line 91 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 102 of file AlgorithmPropertiesWidget.h.
Referenced by addEnabledAndDisableLists(), and isWidgetEnabled().
|
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().
|
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().
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().
|
private |
The grid widget containing the input boxes.
Definition at line 88 of file AlgorithmPropertiesWidget.h.
Referenced by AlgorithmPropertiesWidget(), and initLayout().
|
private |
History of inputs to the algorithm.
Definition at line 105 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 60 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 69 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 66 of file AlgorithmPropertiesWidget.h.
Referenced by AlgorithmPropertiesWidget(), and MantidQt::API::GenericDialog::initLayout().
|
readwrite |
Definition at line 35 of file AlgorithmPropertiesWidget.h.