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. More... | |
void | toggleUseHistory () |
Toggle whether or not to use the previously-entered value. More... | |
void | updateIconVisibility (const QString &error="") |
Update which icons should be shown. More... | |
void | userEditedProperty () |
To be called when a user edits a property, as opposed to one being set programmatically. More... | |
void | valueChangedSlot () |
Emits a signal that the value of the property was changed. More... | |
Signals | |
void | replaceWorkspaceName (const QString &propName) |
Signal is emitted whenever someone clicks the replace WS button. More... | |
void | userChangedProperty () |
void | valueChanged (const QString &propName) |
Signal is emitted whenever the value (as entered by the user) in the GUI changes. More... | |
Public Member Functions | |
void | addReplaceWSButton () |
Create and show the "Replace WS" button. More... | |
QGridLayout * | getGridLayout () |
int | getGridRow () |
virtual QWidget * | getMainWidget ()=0 |
Mantid::Kernel::Property * | getProperty () |
virtual QString | getValue () const =0 |
Return the value of the property given the GUI state. More... | |
bool | inGrid () const |
PropertyWidget (Mantid::Kernel::Property *prop, QWidget *parent=nullptr, QGridLayout *layout=nullptr, int row=-1) | |
Constructor. More... | |
void | setEnabled (bool val) |
Sets all widgets contained within to Enabled. More... | |
void | setError (const QString &error) |
Externally set an error string to display in the validator. More... | |
void | setPreviousValue (const QString &previousValue) |
Set this widget's previously-entered value. More... | |
void | setValue (const QString &value) |
Set the value of the property given into the GUI state. More... | |
void | setVisible (bool val) override |
Sets all widgets contained within to Visible. More... | |
~PropertyWidget () override | |
Destructor. More... | |
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. More... | |
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. More... | |
Protected Attributes | |
QString | m_doc |
Documentation string (tooltip) More... | |
QString | m_enteredValue |
Stored the last non-previously-entered value entered entered by the user. More... | |
QString | m_error |
Error message received when trying to set the value. More... | |
QGridLayout * | m_gridLayout |
Grid layout of the dialog to which we are adding widgets. More... | |
QMap< Info, ClickableLabel * > | m_icons |
Allow icon access by Info enum. More... | |
bool | m_isOutputWsProp |
Whether or not the property is an output workspace. More... | |
QWidget * | m_parent |
Parent widget to add sub-widgets to. More... | |
QString | m_previousValue |
Stores the previously entered value when this dialog was last open. More... | |
Mantid::Kernel::Property * | m_prop |
Property being looked at. This is NOT owned by the widget. More... | |
QPushButton * | m_replaceWSButton |
Button to "replace input workspace". More... | |
int | m_row |
If using the GridLayout, this is the row where the widget was inserted. More... | |
bool | m_useHistory |
History on/off flag. More... | |
QVector< QWidget * > | m_widgets |
All contained widgets. More... | |
Private Member Functions | |
void | setUseHistoryIcon (bool useHistory) |
Sets the history on/off icons. More... | |
virtual void | setValueImpl (const QString &value)=0 |
Base class for widgets that will set Mantid::Kernel::Property* types.
Definition at line 52 of file PropertyWidget.h.
Enumerator | |
---|---|
INVALID | |
REPLACE | |
RESTORE |
Definition at line 60 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 180 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 374 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 82 of file PropertyWidget.h.
|
inline |
Definition at line 85 of file PropertyWidget.h.
|
pure virtual |
|
inline |
Definition at line 90 of file PropertyWidget.h.
Referenced by MantidQt::API::isCalledInputWorkspace().
|
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 322 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 405 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 401 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 443 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 427 of file PropertyWidget.cpp.
Referenced by MantidQt::API::TextPropertyWidget::TextPropertyWidget().
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 272 of file PropertyWidget.cpp.
References Mantid::Kernel::Property::getDefault(), getValue(), m_icons, m_previousValue, m_prop, RESTORE, and setValue().
Referenced by MantidQt::API::AlgorithmPropertiesWidget::initLayout(), and MantidQt::API::AlgorithmDialog::setPreviousValue().
|
private |
Sets the history on/off icons.
useHistory | :: when true, will show the history on image, when false will show the history off image. |
Definition at line 361 of file PropertyWidget.cpp.
References m_icons, m_useHistory, and RESTORE.
Referenced by toggleUseHistory(), 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 261 of file PropertyWidget.cpp.
References 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 413 of file PropertyWidget.cpp.
References m_widgets.
|
slot |
Toggle whether or not to use the previously-entered value.
Definition at line 347 of file PropertyWidget.cpp.
References m_enteredValue, m_previousValue, m_useHistory, setUseHistoryIcon(), and setValue().
Referenced by PropertyWidget().
|
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 here |
Definition at line 295 of file PropertyWidget.cpp.
References error, Mantid::Kernel::Property::getDefault(), getValue(), Mantid::Kernel::SingletonHolder< T >::Instance(), 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 336 of file PropertyWidget.cpp.
References getValue(), m_enteredValue, m_previousValue, setUseHistoryIcon(), updateIconVisibility(), 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 327 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 142 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 |
Stored the last non-previously-entered value entered entered by the user.
Definition at line 160 of file PropertyWidget.h.
Referenced by toggleUseHistory(), and userEditedProperty().
|
protected |
Error message received when trying to set the value.
Definition at line 151 of file PropertyWidget.h.
Referenced by setError(), and updateIconVisibility().
|
protected |
Grid layout of the dialog to which we are adding widgets.
Definition at line 133 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 163 of file PropertyWidget.h.
Referenced by PropertyWidget(), setPreviousValue(), setUseHistoryIcon(), and updateIconVisibility().
|
protected |
Whether or not the property is an output workspace.
Definition at line 154 of file PropertyWidget.h.
Referenced by PropertyWidget(), and updateIconVisibility().
|
protected |
Parent widget to add sub-widgets to.
Definition at line 136 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 previously entered value when this dialog was last open.
Definition at line 157 of file PropertyWidget.h.
Referenced by setPreviousValue(), toggleUseHistory(), and userEditedProperty().
|
protected |
Property being looked at. This is NOT owned by the widget.
Definition at line 130 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(), setPreviousValue(), MantidQt::API::BoolPropertyWidget::setValueImpl(), MantidQt::API::ListPropertyWidget::setValueImpl(), MantidQt::API::OptionsPropertyWidget::setValueImpl(), MantidQt::API::TextPropertyWidget::TextPropertyWidget(), updateIconVisibility(), and valueChangedSlot().
|
protected |
Button to "replace input workspace".
Definition at line 145 of file PropertyWidget.h.
Referenced by addReplaceWSButton().
|
protected |
If using the GridLayout, this is the row where the widget was inserted.
Definition at line 139 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 167 of file PropertyWidget.h.
Referenced by setUseHistoryIcon(), and toggleUseHistory().
|
protected |
All contained widgets.
Definition at line 148 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().