Version: 9.12.0
SalomeApp_DoubleSpinBox Class Reference

#include <SalomeApp_DoubleSpinBox.h>

Inheritance diagram for SalomeApp_DoubleSpinBox:
Inheritance graph

Signals

void textChanged (const QString &)
 

Public Member Functions

 SalomeApp_DoubleSpinBox (QWidget *=0)
 Constructor. More...
 
 SalomeApp_DoubleSpinBox (double, double, double=1, QWidget *=0)
 Constructor. More...
 
 SalomeApp_DoubleSpinBox (double, double, double, int, int, QWidget *=0, bool=true, bool=true)
 Constructor. More...
 
virtual ~SalomeApp_DoubleSpinBox ()
 Destructor. More...
 
virtual void stepBy (int)
 Perform steps increment/decrement steps. More...
 
virtual double valueFromText (const QString &) const
 Interpret text entered by the user as a value. More...
 
virtual QString textFromValue (double) const
 This function is used by the spin box whenever it needs to display the given value. More...
 
virtual QValidator::State validate (QString &, int &) const
 This function is used to determine whether input is valid. More...
 
virtual bool isValid (QString &msg, bool=false)
 This function is used to determine whether input is valid. More...
 
virtual void setDefaultValue (const double)
 This function is used to set a default value for this spinbox. More...
 
virtual void setRange (double, double)
 This function is used to set minimum and maximum values for this spinbox. More...
 
virtual void setValue (double)
 This function is used to set a current value for this spinbox. More...
 
virtual void setText (const QString &)
 This function is used to set a text for this spinbox. More...
 
void setAcceptNames (const bool)
 Enables or disables variable names in the spin box. By default, variable names are enabled. More...
 
bool isAcceptNames () const
 Returns true if the spin box accepts variable names. More...
 
void setShowTipOnValidate (const bool)
 Enables or disables tooltips in case of invalid or intermediate-state input. Tooltips are enabled by default. More...
 
bool isShowTipOnValidate () const
 Returns true if tooltip should be shown in case of invalid or intermediate-state input. More...
 
- Public Member Functions inherited from QtxDoubleSpinBox
 QtxDoubleSpinBox (QWidget *=0)
 Constructor. More...
 
 QtxDoubleSpinBox (double, double, double=1, QWidget *=0)
 Constructor. More...
 
 QtxDoubleSpinBox (double, double, double, int, int, QWidget *=0)
 Constructor. More...
 
virtual ~QtxDoubleSpinBox ()
 Destructor. More...
 
bool isCleared () const
 Check if spin box is in the "cleared" state. More...
 
virtual void setCleared (const bool)
 Change "cleared" status of the spin box. More...
 
int getPrecision () const
 Get precision value of the spin box. More...
 
void setPrecision (const int)
 Set precision of the spin box. More...
 

Protected Slots

void onEditingFinished ()
 This function is called when editing is finished. More...
 
void onTextChanged (const QString &)
 This function is called when value is changed. More...
 
- Protected Slots inherited from QtxDoubleSpinBox
virtual void onTextChanged (const QString &)
 Called when user enters the text in the spin box. More...
 

Protected Member Functions

State isValid (const QString &, double &) const
 This function is used to determine whether input is valid. More...
 
double defaultValue () const
 This function return a default acceptable value (commonly, 0.0). More...
 
bool checkRange (const double) const
 This function is used to check that string value lies within predefined range. More...
 
SearchState findVariable (const QString &, double &) const
 This function is used to determine whether input is a variable name and to get its value. More...
 
virtual void keyPressEvent (QKeyEvent *)
 This function is called when the spinbox recieves key press event. More...
 
virtual void showEvent (QShowEvent *)
 This function is called when the spinbox recieves show event. More...
 
- Protected Member Functions inherited from QtxDoubleSpinBox
QString removeTrailingZeroes (const QString &) const
 Return source string with removed leading and trailing zeros. More...
 

Private Types

enum  State { Invalid = 0 , NoVariable , Incompatible , Acceptable }
 
enum  SearchState { NotFound = 0 , IncorrectType , Found }
 

Private Member Functions

void connectSignalsAndSlots ()
 Connect signals and slots. More...
 

Private Attributes

double myDefaultValue
 
bool myIsRangeSet
 
double myMinimum
 
double myMaximum
 
QString myCorrectValue
 
QString myTextValue
 
bool myAcceptNames
 
bool myShowTip
 

Member Enumeration Documentation

◆ SearchState

Enumerator
NotFound 
IncorrectType 
Found 

◆ State

Enumerator
Invalid 
NoVariable 
Incompatible 
Acceptable 

Constructor & Destructor Documentation

◆ SalomeApp_DoubleSpinBox() [1/3]

SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox ( QWidget parent = 0)

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
parentparent object

References connectSignalsAndSlots().

◆ SalomeApp_DoubleSpinBox() [2/3]

SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox ( double  min,
double  max,
double  step = 1,
QWidget parent = 0 
)

Constructor.

Constructs a spin box with specified minimum, maximum and step value. The precision is set to 2 decimal places. The value is initially set to the minimum value.

Parameters
minspin box minimum possible value
maxspin box maximum possible value
stepspin box increment/decrement value
parentparent object

References connectSignalsAndSlots().

◆ SalomeApp_DoubleSpinBox() [3/3]

SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox ( double  min,
double  max,
double  step,
int  prec,
int  dec,
QWidget parent = 0,
bool  acceptNames = true,
bool  showTip = true 
)

Constructor.

Constructs a spin box with specified minimum, maximum and step value. The precision is set to 2 decimal places. The value is initially set to the minimum value.

Parameters
minspin box minimum possible value
maxspin box maximum possible value
stepspin box increment/decrement value
parentparent object
acceptNamesif true, enables variable names in the spin box
showTipif true, makes the widget show a tooltip when invalid text is entered by the user

References connectSignalsAndSlots().

◆ ~SalomeApp_DoubleSpinBox()

SalomeApp_DoubleSpinBox::~SalomeApp_DoubleSpinBox ( )
virtual

Destructor.

Member Function Documentation

◆ checkRange()

bool SalomeApp_DoubleSpinBox::checkRange ( const double  value) const
protected

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

Returns
check status

References myIsRangeSet, myMaximum, and myMinimum.

◆ connectSignalsAndSlots()

void SalomeApp_DoubleSpinBox::connectSignalsAndSlots ( )
private

Connect signals and slots.

References onEditingFinished(), onTextChanged(), and textChanged().

◆ defaultValue()

double SalomeApp_DoubleSpinBox::defaultValue ( ) const
protected

This function return a default acceptable value (commonly, 0.0).

Returns
default acceptable value

References myDefaultValue, myMaximum, and myMinimum.

◆ findVariable()

SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable ( const QString &  name,
double &  value 
) const
protected

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

Returns
status of search operation

References _PTR(), Found, IncorrectType, NotFound, and SUIT_Session::session().

◆ isAcceptNames()

bool SalomeApp_DoubleSpinBox::isAcceptNames ( ) const

Returns true if the spin box accepts variable names.

References myAcceptNames.

◆ isShowTipOnValidate()

bool SalomeApp_DoubleSpinBox::isShowTipOnValidate ( ) const

Returns true if tooltip should be shown in case of invalid or intermediate-state input.

References myShowTip.

◆ isValid() [1/2]

SalomeApp_DoubleSpinBox::State SalomeApp_DoubleSpinBox::isValid ( const QString &  text,
double &  value 
) const
protected

This function is used to determine whether input is valid.

Returns
validating operation result

References Acceptable, checkRange(), findVariable(), Incompatible, IncorrectType, Invalid, NotFound, and NoVariable.

◆ isValid() [2/2]

bool SalomeApp_DoubleSpinBox::isValid ( QString &  msg,
bool  toCorrect = false 
)
virtual

This function is used to determine whether input is valid.

Returns
validating operation result

References Acceptable, Incompatible, Invalid, myCorrectValue, NoVariable, and setText().

◆ keyPressEvent()

void SalomeApp_DoubleSpinBox::keyPressEvent ( QKeyEvent *  e)
protectedvirtual

This function is called when the spinbox recieves key press event.

◆ onEditingFinished

void SalomeApp_DoubleSpinBox::onEditingFinished ( )
protectedslot

This function is called when editing is finished.

References myTextValue, and setText().

◆ onTextChanged

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

This function is called when value is changed.

References Acceptable, isValid(), myCorrectValue, and myTextValue.

◆ setAcceptNames()

void SalomeApp_DoubleSpinBox::setAcceptNames ( const bool  flag)

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

Parameters
flagIf true, variable names are enabled.

References myAcceptNames.

◆ setDefaultValue()

void SalomeApp_DoubleSpinBox::setDefaultValue ( const double  value)
virtual

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

Parameters
valuedefault value

References myDefaultValue.

◆ setRange()

void SalomeApp_DoubleSpinBox::setRange ( double  min,
double  max 
)
virtual

This function is used to set minimum and maximum values for this spinbox.

Parameters
minminimum value
maxmaximum value

References myIsRangeSet, myMaximum, and myMinimum.

◆ setShowTipOnValidate()

void SalomeApp_DoubleSpinBox::setShowTipOnValidate ( const bool  flag)

Enables or disables tooltips in case of invalid or intermediate-state input. Tooltips are enabled by default.

Parameters
flagIf true, tooltips are enabled.

References myShowTip.

◆ setText()

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

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

Parameters
valuecurrent value

◆ setValue()

void SalomeApp_DoubleSpinBox::setValue ( double  value)
virtual

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

Parameters
valuecurrent value

References myCorrectValue, myTextValue, and QtxDoubleSpinBox::textFromValue().

◆ showEvent()

void SalomeApp_DoubleSpinBox::showEvent ( QShowEvent *  )
protectedvirtual

This function is called when the spinbox recieves show event.

References myTextValue, and setText().

◆ stepBy()

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

Reimplemented from QtxDoubleSpinBox.

References QtxDoubleSpinBox::stepBy().

◆ textChanged

void SalomeApp_DoubleSpinBox::textChanged ( const QString &  )
signal

◆ textFromValue()

QString SalomeApp_DoubleSpinBox::textFromValue ( double  val) const
virtual

This function is used by the spin box whenever it needs to display the given value.

Parameters
valspin box value
Returns
text representation of the value
See also
valueFromText()

Reimplemented from QtxDoubleSpinBox.

References QtxDoubleSpinBox::textFromValue().

◆ validate()

QValidator::State SalomeApp_DoubleSpinBox::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

Reimplemented from QtxDoubleSpinBox.

References QtxDoubleSpinBox::getPrecision(), isAcceptNames(), isShowTipOnValidate(), textFromValue(), and QtxDoubleSpinBox::validate().

◆ valueFromText()

double SalomeApp_DoubleSpinBox::valueFromText ( const QString &  text) const
virtual

Interpret text entered by the user as a value.

Parameters
texttext entered by the user
Returns
mapped value
See also
textFromValue()

Reimplemented from QtxDoubleSpinBox.

References Acceptable, defaultValue(), and isValid().

Member Data Documentation

◆ myAcceptNames

bool SalomeApp_DoubleSpinBox::myAcceptNames
private

◆ myCorrectValue

QString SalomeApp_DoubleSpinBox::myCorrectValue
private

◆ myDefaultValue

double SalomeApp_DoubleSpinBox::myDefaultValue
private

◆ myIsRangeSet

bool SalomeApp_DoubleSpinBox::myIsRangeSet
private

◆ myMaximum

double SalomeApp_DoubleSpinBox::myMaximum
private

◆ myMinimum

double SalomeApp_DoubleSpinBox::myMinimum
private

◆ myShowTip

bool SalomeApp_DoubleSpinBox::myShowTip
private

◆ myTextValue

QString SalomeApp_DoubleSpinBox::myTextValue
private

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