|
Mantid
|
Base class for widgets that will set Mantid::Kernel::Property* types. More...
#include <PropertyWidget.h>
Public Types | |
| enum | Info { INVALID , REPLACE , RESTORE } |
Public Slots | |
| void | replaceWSButtonClicked () |
| Deal with the "replace workspace" button being clicked. | |
| void | toggleUseHistory () |
| Toggle whether or not to use the previously-entered value. | |
| void | updateIconVisibility (const QString &error="") |
| Update which icons should be shown. | |
| void | userEditedProperty () |
| To be called when a user edits a property, as opposed to one being set programmatically. | |
| void | valueChangedSlot () |
| Emits a signal that the value of the property was changed. | |
Signals | |
| void | replaceWorkspaceName (const QString &propName) |
| Signal is emitted whenever someone clicks the replace WS button. | |
| void | userChangedProperty () |
| void | valueChanged (const QString &propName) |
| Signal is emitted whenever the value (as entered by the user) in the GUI changes. | |
Public Member Functions | |
| void | addReplaceWSButton () |
| Create and show the "Replace WS" button. | |
| QGridLayout * | getGridLayout () |
| int | getGridRow () const |
| virtual QWidget * | getMainWidget ()=0 |
| Mantid::Kernel::Property * | getProperty () |
| const Mantid::Kernel::Property * | getProperty () const |
| virtual QString | getValue () const =0 |
| Return the value of the property given the GUI state. | |
| bool | inGrid () const |
| PropertyWidget (Mantid::Kernel::Property *prop, QWidget *parent=nullptr, QGridLayout *layout=nullptr, int row=-1) | |
| Constructor. | |
| void | setEnabled (bool val) |
| Sets all widgets contained within to Enabled. | |
| void | setError (const QString &error) |
| Externally set an error string to display in the validator. | |
| void | setPrevious_isDynamicDefault (bool flag) |
Set the isDynamicDefault flag associated with the previously-entered value. | |
| void | setPreviousValue (const QString &previousValue) |
| Set this widget's previously-entered value. | |
| void | setValue (const QString &value) |
| Set the value of the property given into the GUI state. | |
| void | setVisible (bool val) override |
| Sets all widgets contained within to Visible. | |
| void | transferHistoryState (const PropertyWidget *other, const PropertyWidget *upstream=nullptr) |
Transfer the history state from another PropertyWidget, possibly additionally depending on the history state of an upstream property. | |
| ~PropertyWidget () override | |
| Destructor. | |
Static Public Member Functions | |
| static void | setFieldPlaceholderText (Mantid::Kernel::Property *prop, QLineEdit *field) |
| Set the placeholder text of the given field based on the default value of the given property. | |
Static Protected Member Functions | |
| static void | setLabelFont (Mantid::Kernel::Property *prop, QWidget *label) |
| Set the font of the given label based on the optional/required status of the given property. | |
Protected Attributes | |
| QString | m_doc |
| Documentation string (tooltip) | |
| bool | m_entered_isDynamicDefault |
Stores the isDynamicDefault flag corresponding to the last value entered by the user. | |
| QString | m_enteredValue |
| Stores the last value entered by the user. | |
| QString | m_error |
| Error message received when trying to set the value. | |
| QGridLayout * | m_gridLayout |
| Grid layout of the dialog to which we are adding widgets. | |
| QMap< Info, ClickableLabel * > | m_icons |
| Allow icon access by Info enum. | |
| bool | m_isOutputWsProp |
| Whether or not the property is an output workspace. | |
| QString | m_lastValue |
| Last modified value. | |
| QWidget * | m_parent |
| Parent widget to add sub-widgets to. | |
| bool | m_previous_isDynamicDefault |
Stores the isDynamicDefault flag corresponding to the previously entered value. | |
| QString | m_previousValue |
| Stores the previously entered value when this dialog was last open. | |
| Mantid::Kernel::Property * | m_prop |
| Property being looked at. This is NOT owned by the widget. | |
| QPushButton * | m_replaceWSButton |
| Button to "replace input workspace". | |
| int | m_row |
| If using the GridLayout, this is the row where the widget was inserted. | |
| bool | m_useHistory |
| History on/off flag. | |
| QList< QWidget * > | m_widgets |
| All contained widgets. | |
Private Member Functions | |
| void | setUseHistoryIcon (bool useHistory, bool isDynamicDefault) |
| Sets the history on/off icons and the dynamic-default marker. | |
| virtual void | setValueImpl (const QString &value)=0 |
Base class for widgets that will set Mantid::Kernel::Property* types.
Definition at line 51 of file PropertyWidget.h.
| Enumerator | |
|---|---|
| INVALID | |
| REPLACE | |
| RESTORE | |
Definition at line 59 of file PropertyWidget.h.
| MantidQt::API::PropertyWidget::PropertyWidget | ( | Mantid::Kernel::Property * | prop, |
| QWidget * | parent = nullptr, |
||
| QGridLayout * | layout = nullptr, |
||
| int | row = -1 |
||
| ) |
Constructor.
Save the documentation tooltip
Definition at line 181 of file PropertyWidget.cpp.
References Mantid::Kernel::Property::direction(), Mantid::Kernel::Property::documentation(), INVALID, lower, m_doc, m_gridLayout, m_icons, m_isOutputWsProp, m_parent, m_row, Mantid::Kernel::Property::name(), Mantid::Kernel::Direction::Output, REPLACE, RESTORE, and toggleUseHistory().
|
overridedefault |
Destructor.
| void MantidQt::API::PropertyWidget::addReplaceWSButton | ( | ) |
Create and show the "Replace WS" button.
This only has an effect for Output WorkspaceProperty's.
Definition at line 479 of file PropertyWidget.cpp.
References Mantid::Kernel::Property::direction(), m_gridLayout, m_parent, m_prop, m_replaceWSButton, m_row, m_widgets, Mantid::Kernel::Direction::Output, replaceWSButtonClicked(), and valueChangedSlot().
Referenced by MantidQt::API::AlgorithmPropertiesWidget::initLayout().
|
inline |
Definition at line 87 of file PropertyWidget.h.
|
inline |
Definition at line 90 of file PropertyWidget.h.
|
pure virtual |
|
inline |
Definition at line 96 of file PropertyWidget.h.
|
inline |
Definition at line 95 of file PropertyWidget.h.
Referenced by MantidQt::API::isCalledInputWorkspaceOrLHSWorkspace(), and MantidQt::API::AlgorithmPropertiesWidget::saveInput().
|
pure virtual |
Return the value of the property given the GUI state.
Implemented in MantidQt::API::BoolPropertyWidget, MantidQt::API::ListPropertyWidget, MantidQt::API::OptionsPropertyWidget, and MantidQt::API::TextPropertyWidget.
Referenced by MantidQt::API::AlgorithmPropertiesWidget::replaceWSClicked(), MantidQt::API::AlgorithmPropertiesWidget::saveInput(), setPreviousValue(), updateIconVisibility(), and userEditedProperty().
| bool MantidQt::API::PropertyWidget::inGrid | ( | ) | const |
|
signal |
Signal is emitted whenever someone clicks the replace WS button.
Referenced by replaceWSButtonClicked().
|
slot |
Deal with the "replace workspace" button being clicked.
Slot called when someone clicks the "replace ws button".
Definition at line 392 of file PropertyWidget.cpp.
References m_prop, Mantid::Kernel::Property::name(), and replaceWorkspaceName().
Referenced by addReplaceWSButton().
| void MantidQt::API::PropertyWidget::setEnabled | ( | bool | val | ) |
Sets all widgets contained within to Enabled.
| val | :: enabled or not |
Definition at line 510 of file PropertyWidget.cpp.
References m_widgets.
| void MantidQt::API::PropertyWidget::setError | ( | const QString & | error | ) |
Externally set an error string to display in the validator.
| error | :: string to show in the star, empty means no error |
Definition at line 506 of file PropertyWidget.cpp.
References error, and m_error.
Referenced by MantidQt::API::AlgorithmPropertiesWidget::initLayout(), and updateIconVisibility().
|
static |
Set the placeholder text of the given field based on the default value of the given property.
Given a property and its associated QLineEdit text field, will set the field's placeholder text based on the default value of the property.
| prop | :: the property who's default value to use |
| field | :: the associated text field to set the placeholder text of |
Definition at line 548 of file PropertyWidget.cpp.
Referenced by MantidQt::API::TextPropertyWidget::TextPropertyWidget(), and MantidQt::API::AlgorithmDialog::tie().
|
staticprotected |
Set the font of the given label based on the optional/required status of the given property.
Given a property and its associated label, will make font adjustments to the label based on whether or not the property is mandatory.
| prop | :: property to which the label belongs |
| label | :: widget containing the label |
Definition at line 532 of file PropertyWidget.cpp.
Referenced by MantidQt::API::TextPropertyWidget::TextPropertyWidget().
| void MantidQt::API::PropertyWidget::setPrevious_isDynamicDefault | ( | bool | flag | ) |
Set the isDynamicDefault flag associated with the previously-entered value.
Set this widget's isDynamicDefault flag to correspond to the previously-entered value.
| flag | :: the isDynamicDefault state for the previous value of this widget |
Definition at line 317 of file PropertyWidget.cpp.
References m_previous_isDynamicDefault, m_prop, and Mantid::Kernel::Property::setIsDynamicDefault().
Referenced by MantidQt::API::AlgorithmPropertiesWidget::initLayout(), and MantidQt::API::AlgorithmDialog::setPreviousValue().
| void MantidQt::API::PropertyWidget::setPreviousValue | ( | const QString & | previousValue | ) |
Set this widget's previously-entered value.
Set this widget's value as a previously-entered value.
| previousValue | :: the previous value of this widget |
Definition at line 292 of file PropertyWidget.cpp.
References Mantid::Kernel::Property::getDefault(), getValue(), Mantid::Kernel::Property::isDynamicDefault(), m_icons, m_previousValue, m_prop, m_useHistory, RESTORE, setUseHistoryIcon(), and setValue().
Referenced by MantidQt::API::AlgorithmPropertiesWidget::initLayout(), and MantidQt::API::AlgorithmDialog::setPreviousValue().
|
private |
Sets the history on/off icons and the dynamic-default marker.
Sets the history on/off icons.
| useHistory | :: when true, will show the history on image, when false will show the history off image. |
| isDynamicDefault | :: when true, indicates that the property's value has been changed from its default value, as a result of the value of an upstream property. |
Definition at line 462 of file PropertyWidget.cpp.
References m_enteredValue, m_icons, RESTORE, and setVisible().
Referenced by setPreviousValue(), toggleUseHistory(), transferHistoryState(), and userEditedProperty().
| void MantidQt::API::PropertyWidget::setValue | ( | const QString & | value | ) |
Set the value of the property given into the GUI state.
Set this widget's value.
| value | :: the value to set |
Definition at line 271 of file PropertyWidget.cpp.
References m_error, m_lastValue, setValueImpl(), updateIconVisibility(), value, and valueChangedSlot().
Referenced by MantidQt::API::BoolPropertyWidget::BoolPropertyWidget(), MantidQt::API::FilePropertyWidget::FilePropertyWidget(), MantidQt::API::ListPropertyWidget::ListPropertyWidget(), MantidQt::API::OptionsPropertyWidget::OptionsPropertyWidget(), MantidQt::API::AlgorithmPropertiesWidget::replaceWSClicked(), setPreviousValue(), MantidQt::API::TextPropertyWidget::TextPropertyWidget(), and toggleUseHistory().
|
privatepure virtual |
Implemented in MantidQt::API::BoolPropertyWidget, MantidQt::API::ListPropertyWidget, MantidQt::API::OptionsPropertyWidget, and MantidQt::API::TextPropertyWidget.
Referenced by setValue().
|
override |
Sets all widgets contained within to Visible.
| val | :: Visible or not |
Definition at line 518 of file PropertyWidget.cpp.
References m_widgets.
Referenced by setUseHistoryIcon().
|
slot |
Toggle whether or not to use the previously-entered value.
Definition at line 441 of file PropertyWidget.cpp.
References Mantid::Kernel::Property::isDynamicDefault(), m_entered_isDynamicDefault, m_enteredValue, m_previous_isDynamicDefault, m_previousValue, m_prop, m_useHistory, Mantid::Kernel::Property::setIsDynamicDefault(), setUseHistoryIcon(), and setValue().
Referenced by PropertyWidget().
| void MantidQt::API::PropertyWidget::transferHistoryState | ( | const PropertyWidget * | other, |
| const PropertyWidget * | upstream = nullptr |
||
| ) |
Transfer the history state from another PropertyWidget, possibly additionally depending on the history state of an upstream property.
Transfer the history state from another PropertyWidget, possibly additionally depending on the state of an upstream property.
This method is provided to facilitate end-user classes which need to be able to completely re-create a PropertyWidget from scratch, usually in the case of a dynamic-default value derived from an upstream property.
| other | :: the PropertyWidget to transfer the history state from |
| upstream | :: [optional] additionally adjust the state to be consistent with that of an upstream property. |
Definition at line 334 of file PropertyWidget.cpp.
References Mantid::Kernel::Property::isDynamicDefault(), m_entered_isDynamicDefault, m_enteredValue, m_icons, m_previous_isDynamicDefault, m_previousValue, m_prop, m_useHistory, RESTORE, setUseHistoryIcon(), value, and Mantid::Kernel::Property::value().
|
slot |
Update which icons should be shown.
| error | An optional error string. If empty the property is revalidated by calling prop->setValue and the error is pulled from there |
Definition at line 365 of file PropertyWidget.cpp.
References error, Mantid::Kernel::Property::getDefault(), getValue(), INVALID, m_error, m_icons, m_isOutputWsProp, m_prop, REPLACE, setError(), Mantid::Kernel::Property::setValue(), and value.
Referenced by MantidQt::API::OptionsPropertyWidget::editingFinished(), setValue(), and userEditedProperty().
|
signal |
|
slot |
To be called when a user edits a property, as opposed to one being set programmatically.
Definition at line 406 of file PropertyWidget.cpp.
References getValue(), Mantid::Kernel::Property::isDynamicDefault(), m_entered_isDynamicDefault, m_enteredValue, m_error, m_lastValue, m_previous_isDynamicDefault, m_previousValue, m_prop, m_useHistory, Mantid::Kernel::Property::setIsDynamicDefault(), setUseHistoryIcon(), updateIconVisibility(), value, and valueChangedSlot().
Referenced by MantidQt::API::BoolPropertyWidget::BoolPropertyWidget(), MantidQt::API::FilePropertyWidget::browseClicked(), MantidQt::API::ListPropertyWidget::ListPropertyWidget(), MantidQt::API::OptionsPropertyWidget::OptionsPropertyWidget(), MantidQt::API::AlgorithmPropertiesWidget::replaceWSClicked(), and MantidQt::API::TextPropertyWidget::TextPropertyWidget().
|
signal |
Signal is emitted whenever the value (as entered by the user) in the GUI changes.
Referenced by valueChangedSlot().
|
slot |
Emits a signal that the value of the property was changed.
Definition at line 397 of file PropertyWidget.cpp.
References m_prop, Mantid::Kernel::Property::name(), and valueChanged().
Referenced by addReplaceWSButton(), SmoothNeighboursDialog::initLayout(), setValue(), and userEditedProperty().
|
protected |
Documentation string (tooltip)
Definition at line 152 of file PropertyWidget.h.
Referenced by MantidQt::API::BoolPropertyWidget::BoolPropertyWidget(), MantidQt::API::ListPropertyWidget::ListPropertyWidget(), MantidQt::API::OptionsPropertyWidget::OptionsPropertyWidget(), PropertyWidget(), and MantidQt::API::TextPropertyWidget::TextPropertyWidget().
|
protected |
Stores the isDynamicDefault flag corresponding to the last value entered by the user.
Definition at line 179 of file PropertyWidget.h.
Referenced by toggleUseHistory(), transferHistoryState(), and userEditedProperty().
|
protected |
Stores the last value entered by the user.
Definition at line 176 of file PropertyWidget.h.
Referenced by setUseHistoryIcon(), toggleUseHistory(), transferHistoryState(), and userEditedProperty().
|
protected |
Error message received when trying to set the value.
Definition at line 164 of file PropertyWidget.h.
Referenced by setError(), setValue(), updateIconVisibility(), and userEditedProperty().
|
protected |
Grid layout of the dialog to which we are adding widgets.
Definition at line 143 of file PropertyWidget.h.
Referenced by addReplaceWSButton(), MantidQt::API::BoolPropertyWidget::BoolPropertyWidget(), MantidQt::API::FilePropertyWidget::FilePropertyWidget(), MantidQt::API::ListPropertyWidget::ListPropertyWidget(), MantidQt::API::OptionsPropertyWidget::OptionsPropertyWidget(), PropertyWidget(), and MantidQt::API::TextPropertyWidget::TextPropertyWidget().
|
protected |
Allow icon access by Info enum.
Definition at line 182 of file PropertyWidget.h.
Referenced by PropertyWidget(), setPreviousValue(), setUseHistoryIcon(), transferHistoryState(), and updateIconVisibility().
|
protected |
Whether or not the property is an output workspace.
Definition at line 167 of file PropertyWidget.h.
Referenced by PropertyWidget(), and updateIconVisibility().
|
protected |
Last modified value.
Definition at line 161 of file PropertyWidget.h.
Referenced by setValue(), and userEditedProperty().
|
protected |
Parent widget to add sub-widgets to.
Definition at line 146 of file PropertyWidget.h.
Referenced by addReplaceWSButton(), MantidQt::API::BoolPropertyWidget::BoolPropertyWidget(), MantidQt::API::FilePropertyWidget::FilePropertyWidget(), MantidQt::API::ListPropertyWidget::ListPropertyWidget(), MantidQt::API::OptionsPropertyWidget::OptionsPropertyWidget(), PropertyWidget(), and MantidQt::API::TextPropertyWidget::TextPropertyWidget().
|
protected |
Stores the isDynamicDefault flag corresponding to the previously entered value.
Definition at line 173 of file PropertyWidget.h.
Referenced by setPrevious_isDynamicDefault(), toggleUseHistory(), transferHistoryState(), and userEditedProperty().
|
protected |
Stores the previously entered value when this dialog was last open.
Definition at line 170 of file PropertyWidget.h.
Referenced by setPreviousValue(), toggleUseHistory(), transferHistoryState(), and userEditedProperty().
|
protected |
Property being looked at. This is NOT owned by the widget.
Definition at line 140 of file PropertyWidget.h.
Referenced by addReplaceWSButton(), MantidQt::API::BoolPropertyWidget::BoolPropertyWidget(), MantidQt::API::FilePropertyWidget::browseClicked(), MantidQt::API::OptionsPropertyWidget::editingFinished(), MantidQt::API::FilePropertyWidget::FilePropertyWidget(), MantidQt::API::ListPropertyWidget::ListPropertyWidget(), MantidQt::API::OptionsPropertyWidget::OptionsPropertyWidget(), replaceWSButtonClicked(), setPrevious_isDynamicDefault(), setPreviousValue(), MantidQt::API::BoolPropertyWidget::setValueImpl(), MantidQt::API::ListPropertyWidget::setValueImpl(), MantidQt::API::OptionsPropertyWidget::setValueImpl(), MantidQt::API::TextPropertyWidget::TextPropertyWidget(), toggleUseHistory(), transferHistoryState(), updateIconVisibility(), userEditedProperty(), and valueChangedSlot().
|
protected |
Button to "replace input workspace".
Definition at line 155 of file PropertyWidget.h.
Referenced by addReplaceWSButton().
|
protected |
If using the GridLayout, this is the row where the widget was inserted.
Definition at line 149 of file PropertyWidget.h.
Referenced by addReplaceWSButton(), MantidQt::API::BoolPropertyWidget::BoolPropertyWidget(), MantidQt::API::FilePropertyWidget::FilePropertyWidget(), MantidQt::API::ListPropertyWidget::ListPropertyWidget(), MantidQt::API::OptionsPropertyWidget::OptionsPropertyWidget(), PropertyWidget(), and MantidQt::API::TextPropertyWidget::TextPropertyWidget().
|
protected |
History on/off flag.
Note this is different from whether or not the property has a previously-entered value to actually use.
Definition at line 186 of file PropertyWidget.h.
Referenced by setPreviousValue(), toggleUseHistory(), transferHistoryState(), and userEditedProperty().
|
protected |
All contained widgets.
Definition at line 158 of file PropertyWidget.h.
Referenced by addReplaceWSButton(), MantidQt::API::BoolPropertyWidget::BoolPropertyWidget(), MantidQt::API::FilePropertyWidget::FilePropertyWidget(), MantidQt::API::ListPropertyWidget::ListPropertyWidget(), MantidQt::API::OptionsPropertyWidget::OptionsPropertyWidget(), setEnabled(), setVisible(), and MantidQt::API::TextPropertyWidget::TextPropertyWidget().