SHAPER  9.13.0
ModuleBase_ParamSpinBox Class Reference

An extension of a double spin box which let to use parameters and expressions for value definition. More...

Inheritance diagram for ModuleBase_ParamSpinBox:
Inheritance graph

Signals

void textChanged (const QString &)
 

Public Member Functions

 ModuleBase_ParamSpinBox (QWidget *theParent=0, int thePrecision=12)
 Constructor. More...
 
void setCompletionList (QStringList &)
 Set list of completion strings. More...
 
virtual ~ModuleBase_ParamSpinBox ()
 Destructor. More...
 
virtual void stepBy (int)
 Perform steps increment/decrement steps. More...
 
virtual QValidator::State validate (QString &, int &) const
 This function is used to determine whether input is valid. More...
 
virtual void setValue (double)
 This function is used to set a current value for this spinbox. More...
 
double value () const
 
virtual void setText (const QString &)
 This function is used to set a text for this spinbox. More...
 
QString text () const
 
void setAcceptVariables (const bool)
 Set a flag about accepted variable. More...
 
bool isAcceptVariables () const
 Returns accepted variables flag. More...
 
bool hasVariable () const
 Returns True if the input value contains variable. More...
 
double minimum () const
 
double maximum () const
 
void setMinimum (double theMin)
 
void setMaximum (double theMax)
 
int decimals () const
 
void setDecimals (int thePrecision)
 
double singleStep () const
 
void setSingleStep (double theStep)
 
void setValueEnabled (bool theEnable)
 

Protected Member Functions

virtual void keyReleaseEvent (QKeyEvent *event)
 This function is called when the spinbox receives key release event. More...
 
virtual bool eventFilter (QObject *theObj, QEvent *theEvent)
 
virtual void timerEvent (QTimerEvent *)
 The virtual function is reimplemented in order to avoid extra increasing of value by StepBy method. More...
 
virtual StepEnabled stepEnabled () const
 
bool hasVariable (const QString &theText) const
 Returns True if the given text contains variable. More...
 

Detailed Description

An extension of a double spin box which let to use parameters and expressions for value definition.

Constructor & Destructor Documentation

◆ ModuleBase_ParamSpinBox()

ModuleBase_ParamSpinBox::ModuleBase_ParamSpinBox ( QWidget theParent = 0,
int  thePrecision = 12 
)

Constructor.

Constructs a spin box with 0.0 as minimum value and 99.99 as maximum value, a step value of 1.0 and a precision of 2 decimal places. The value is initially set to 0.00.

Parameters
theParenta parent object
thePrecisiona precision of values display

◆ ~ModuleBase_ParamSpinBox()

ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox ( )
virtual

Destructor.

Member Function Documentation

◆ setCompletionList()

void ModuleBase_ParamSpinBox::setCompletionList ( QStringList &  theList)

Set list of completion strings.

◆ stepBy()

void ModuleBase_ParamSpinBox::stepBy ( int  steps)
virtual

Perform steps increment/decrement steps.

Re-implemented to handle cases when Notebook variable name is specified by the user as the widget text. Otherwise, simply calls the base implementation.

Parameters
stepsnumber of increment/decrement steps

◆ validate()

QValidator::State ModuleBase_ParamSpinBox::validate ( QString &  str,
int &  pos 
) const
virtual

This function is used to determine whether input is valid.

Parameters
strcurrently entered value
poscursor position in the string
Returns
validating operation result

If decimals = 0 do not accept '.' (interpret as int)

◆ setValue()

void ModuleBase_ParamSpinBox::setValue ( double  value)
virtual

This function is used to set a current value for this spinbox.

Parameters
valuecurrent value

The new value is ignored if the spinbox has a variable.

◆ setText()

void ModuleBase_ParamSpinBox::setText ( const QString &  value)
virtual

This function is used to set a text for this spinbox.

Parameters
valuecurrent value

◆ setAcceptVariables()

void ModuleBase_ParamSpinBox::setAcceptVariables ( const bool  flag)

Set a flag about accepted variable.

Enables or disables variable names in the spin box. By default, variable names are enabled.

Parameters
flagIf true, variable names are enabled.

◆ isAcceptVariables()

bool ModuleBase_ParamSpinBox::isAcceptVariables ( ) const

Returns accepted variables flag.

Returns true if the spin box accepts variable names.

◆ hasVariable() [1/2]

bool ModuleBase_ParamSpinBox::hasVariable ( ) const

Returns True if the input value contains variable.

◆ keyReleaseEvent()

void ModuleBase_ParamSpinBox::keyReleaseEvent ( QKeyEvent *  event)
protectedvirtual

This function is called when the spinbox receives key release event.

◆ timerEvent()

virtual void ModuleBase_ParamSpinBox::timerEvent ( QTimerEvent *  )
inlineprotectedvirtual

The virtual function is reimplemented in order to avoid extra increasing of value by StepBy method.

◆ hasVariable() [2/2]

bool ModuleBase_ParamSpinBox::hasVariable ( const QString &  theText) const
protected

Returns True if the given text contains variable.

Parameters
theTexta text string