SHAPER  9.12.0
ModuleBase_ParamIntSpinBox Class Reference

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

Inheritance diagram for ModuleBase_ParamIntSpinBox:
Inheritance graph

Public Member Functions

 ModuleBase_ParamIntSpinBox (QWidget *theParent=0)
 Constructor. More...
 
virtual ~ModuleBase_ParamIntSpinBox ()
 Destructor. More...
 
virtual void stepBy (int)
 Perform steps increment/decrement steps. More...
 
virtual int valueFromText (const QString &) const
 Convert Int value from text string. More...
 
virtual QString textFromValue (int) const
 Convert text string from int value. More...
 
virtual QValidator::State validate (QString &, int &) const
 Validate the value. More...
 
virtual void setValue (int)
 Set current int value. More...
 
virtual void setText (const QString &)
 Set current text value. More...
 
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...
 

Protected Slots

void onTextChanged (const QString &)
 A slot called on text change. More...
 

Protected Member Functions

bool hasVariable (const QString &theText) const
 Returns True if the given text contains variable. More...
 
State isValid (const QString &, double &) const
 Returns state of the control. More...
 
bool checkRange (const double) const
 Returns True if the given value is within min and max of the control. More...
 
bool findVariable (const QString &theName, double &outValue) const
 Finds a variable by its name. More...
 
virtual void showEvent (QShowEvent *)
 This function is called when the spinbox receives show event. More...
 
virtual void keyPressEvent (QKeyEvent *theEvent)
 Called on key press event. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ ModuleBase_ParamIntSpinBox()

ModuleBase_ParamIntSpinBox::ModuleBase_ParamIntSpinBox ( QWidget theParent = 0)
explicit

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

◆ ~ModuleBase_ParamIntSpinBox()

ModuleBase_ParamIntSpinBox::~ModuleBase_ParamIntSpinBox ( )
virtual

Destructor.

Member Function Documentation

◆ stepBy()

void ModuleBase_ParamIntSpinBox::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

◆ valueFromText()

int ModuleBase_ParamIntSpinBox::valueFromText ( const QString &  theText) const
virtual

Convert Int value from text string.

◆ textFromValue()

QString ModuleBase_ParamIntSpinBox::textFromValue ( int  theValue) const
virtual

Convert text string from int value.

◆ validate()

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

Validate the value.

This function is used to determine whether input is valid.

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

◆ setValue()

void ModuleBase_ParamIntSpinBox::setValue ( int  value)
virtual

Set current int value.

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_ParamIntSpinBox::setText ( const QString &  value)
virtual

Set current text value.

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

Parameters
valuecurrent value

◆ setAcceptVariables()

void ModuleBase_ParamIntSpinBox::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_ParamIntSpinBox::isAcceptVariables ( ) const

Returns accepted variables flag.

Returns true if the spin box accepts variable names.

◆ hasVariable() [1/2]

bool ModuleBase_ParamIntSpinBox::hasVariable ( ) const

Returns True if the input value contains variable.

◆ hasVariable() [2/2]

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

Returns True if the given text contains variable.

Parameters
theTexta text string

◆ isValid()

ModuleBase_ParamIntSpinBox::State ModuleBase_ParamIntSpinBox::isValid ( const QString &  theText,
double &  theValue 
) const
protected

Returns state of the control.

This function is used to determine whether input is valid.

Returns
validating operation result

◆ checkRange()

bool ModuleBase_ParamIntSpinBox::checkRange ( const double  theValue) const
protected

Returns True if the given value is within min and max of the control.

This function is used to check that string value lies within predefined range.

Returns
check status

◆ findVariable()

bool ModuleBase_ParamIntSpinBox::findVariable ( const QString &  theName,
double &  outValue 
) const
protected

Finds a variable by its name.

This function is used to determine whether input is a variable name and to get its value.

Returns true in success

Parameters
theNamea name of variable
outValuean output value of the variable
Returns
status of search operation

◆ showEvent()

void ModuleBase_ParamIntSpinBox::showEvent ( QShowEvent *  theEvent)
protectedvirtual

This function is called when the spinbox receives show event.

◆ onTextChanged

void ModuleBase_ParamIntSpinBox::onTextChanged ( const QString &  text)
protectedslot

A slot called on text change.

◆ keyPressEvent()

void ModuleBase_IntSpinBox::keyPressEvent ( QKeyEvent *  theEvent)
protectedvirtualinherited

Called on key press event.