Mantid
Loading...
Searching...
No Matches
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
MantidQt::API::PropertyWidget Class Referenceabstract

Base class for widgets that will set Mantid::Kernel::Property* types. More...

#include <PropertyWidget.h>

Inheritance diagram for MantidQt::API::PropertyWidget:
MantidQt::API::BoolPropertyWidget MantidQt::API::ListPropertyWidget MantidQt::API::OptionsPropertyWidget MantidQt::API::TextPropertyWidget MantidQt::API::FilePropertyWidget

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::PropertygetProperty ()
 
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::Propertym_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
 

Detailed Description

Base class for widgets that will set Mantid::Kernel::Property* types.

Date
2012-02-16

Definition at line 52 of file PropertyWidget.h.

Member Enumeration Documentation

◆ Info

Enumerator
INVALID 
REPLACE 
RESTORE 

Definition at line 60 of file PropertyWidget.h.

Constructor & Destructor Documentation

◆ PropertyWidget()

MantidQt::API::PropertyWidget::PropertyWidget ( Mantid::Kernel::Property prop,
QWidget *  parent = nullptr,
QGridLayout *  layout = nullptr,
int  row = -1 
)

◆ ~PropertyWidget()

MantidQt::API::PropertyWidget::~PropertyWidget ( )
overridedefault

Destructor.

Member Function Documentation

◆ addReplaceWSButton()

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

◆ getGridLayout()

QGridLayout * MantidQt::API::PropertyWidget::getGridLayout ( )
inline
Returns
the Layout object that these widget(s) are in.

Definition at line 82 of file PropertyWidget.h.

◆ getGridRow()

int MantidQt::API::PropertyWidget::getGridRow ( )
inline
Returns
the row of the widgets in the Layout

Definition at line 85 of file PropertyWidget.h.

◆ getMainWidget()

virtual QWidget * MantidQt::API::PropertyWidget::getMainWidget ( )
pure virtual

◆ getProperty()

Mantid::Kernel::Property * MantidQt::API::PropertyWidget::getProperty ( )
inline
Returns
the property in the widget

Definition at line 90 of file PropertyWidget.h.

Referenced by MantidQt::API::isCalledInputWorkspace().

◆ getValue()

virtual QString MantidQt::API::PropertyWidget::getValue ( ) const
pure virtual

◆ inGrid()

bool MantidQt::API::PropertyWidget::inGrid ( ) const

◆ replaceWorkspaceName

void MantidQt::API::PropertyWidget::replaceWorkspaceName ( const QString &  propName)
signal

Signal is emitted whenever someone clicks the replace WS button.

Referenced by replaceWSButtonClicked().

◆ replaceWSButtonClicked

void MantidQt::API::PropertyWidget::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().

◆ setEnabled()

void MantidQt::API::PropertyWidget::setEnabled ( bool  val)

Sets all widgets contained within to Enabled.

Parameters
val:: enabled or not

Definition at line 405 of file PropertyWidget.cpp.

References m_widgets.

◆ setError()

void MantidQt::API::PropertyWidget::setError ( const QString &  error)

Externally set an error string to display in the validator.

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

◆ setFieldPlaceholderText()

void MantidQt::API::PropertyWidget::setFieldPlaceholderText ( Mantid::Kernel::Property prop,
QLineEdit *  field 
)
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.

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

◆ setLabelFont()

void MantidQt::API::PropertyWidget::setLabelFont ( Mantid::Kernel::Property prop,
QWidget *  label 
)
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.

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

◆ 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.

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

◆ setUseHistoryIcon()

void MantidQt::API::PropertyWidget::setUseHistoryIcon ( bool  useHistory)
private

Sets the history on/off icons.

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

◆ setValue()

void MantidQt::API::PropertyWidget::setValue ( const QString &  value)

◆ setValueImpl()

virtual void MantidQt::API::PropertyWidget::setValueImpl ( const QString &  value)
privatepure virtual

◆ setVisible()

void MantidQt::API::PropertyWidget::setVisible ( bool  val)
override

Sets all widgets contained within to Visible.

Parameters
val:: Visible or not

Definition at line 413 of file PropertyWidget.cpp.

References m_widgets.

◆ toggleUseHistory

void MantidQt::API::PropertyWidget::toggleUseHistory ( )
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().

◆ updateIconVisibility

void MantidQt::API::PropertyWidget::updateIconVisibility ( const QString &  error = "")
slot

Update which icons should be shown.

Parameters
errorAn 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().

◆ userChangedProperty

void MantidQt::API::PropertyWidget::userChangedProperty ( )
signal

◆ userEditedProperty

void MantidQt::API::PropertyWidget::userEditedProperty ( )
slot

◆ valueChanged

void MantidQt::API::PropertyWidget::valueChanged ( const QString &  propName)
signal

Signal is emitted whenever the value (as entered by the user) in the GUI changes.

Referenced by valueChangedSlot().

◆ valueChangedSlot

void MantidQt::API::PropertyWidget::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().

Member Data Documentation

◆ m_doc

QString MantidQt::API::PropertyWidget::m_doc
protected

◆ m_enteredValue

QString MantidQt::API::PropertyWidget::m_enteredValue
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().

◆ m_error

QString MantidQt::API::PropertyWidget::m_error
protected

Error message received when trying to set the value.

Definition at line 151 of file PropertyWidget.h.

Referenced by setError(), and updateIconVisibility().

◆ m_gridLayout

QGridLayout* MantidQt::API::PropertyWidget::m_gridLayout
protected

◆ m_icons

QMap<Info, ClickableLabel *> MantidQt::API::PropertyWidget::m_icons
protected

Allow icon access by Info enum.

Definition at line 163 of file PropertyWidget.h.

Referenced by PropertyWidget(), setPreviousValue(), setUseHistoryIcon(), and updateIconVisibility().

◆ m_isOutputWsProp

bool MantidQt::API::PropertyWidget::m_isOutputWsProp
protected

Whether or not the property is an output workspace.

Definition at line 154 of file PropertyWidget.h.

Referenced by PropertyWidget(), and updateIconVisibility().

◆ m_parent

QWidget* MantidQt::API::PropertyWidget::m_parent
protected

◆ m_previousValue

QString MantidQt::API::PropertyWidget::m_previousValue
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().

◆ m_prop

Mantid::Kernel::Property* MantidQt::API::PropertyWidget::m_prop
protected

◆ m_replaceWSButton

QPushButton* MantidQt::API::PropertyWidget::m_replaceWSButton
protected

Button to "replace input workspace".

Definition at line 145 of file PropertyWidget.h.

Referenced by addReplaceWSButton().

◆ m_row

int MantidQt::API::PropertyWidget::m_row
protected

◆ m_useHistory

bool MantidQt::API::PropertyWidget::m_useHistory
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().

◆ m_widgets

QVector<QWidget *> MantidQt::API::PropertyWidget::m_widgets
protected

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