Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

Enumerator
NotFound 
IncorrectType 
Found 
Enumerator
Invalid 
NoVariable 
Incompatible 
Acceptable 

Constructor & Destructor Documentation

SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox ( QWidget parent = 0)

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::SalomeApp_DoubleSpinBox ( double  min,
double  max,
double  step = 1,
QWidget parent = 0 
)

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::SalomeApp_DoubleSpinBox ( double  min,
double  max,
double  step,
int  prec,
int  dec,
QWidget parent = 0,
bool  acceptNames = true,
bool  showTip = true 
)

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

Member Function Documentation

bool SalomeApp_DoubleSpinBox::checkRange ( const double  value) const
protected
Returns
check status

References myIsRangeSet, myMaximum, and myMinimum.

void SalomeApp_DoubleSpinBox::connectSignalsAndSlots ( )
private
double SalomeApp_DoubleSpinBox::defaultValue ( ) const
protected
Returns
default acceptable value

References myDefaultValue, myMaximum, and myMinimum.

SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable ( const QString &  name,
double &  value 
) const
protected
Returns
status of search operation

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

bool SalomeApp_DoubleSpinBox::isAcceptNames ( ) const

References myAcceptNames.

bool SalomeApp_DoubleSpinBox::isShowTipOnValidate ( ) const

References myShowTip.

bool SalomeApp_DoubleSpinBox::isValid ( QString &  msg,
bool  toCorrect = false 
)
virtual
Returns
validating operation result

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

SalomeApp_DoubleSpinBox::State SalomeApp_DoubleSpinBox::isValid ( const QString &  text,
double &  value 
) const
protected
Returns
validating operation result

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

void SalomeApp_DoubleSpinBox::keyPressEvent ( QKeyEvent *  e)
protectedvirtual
void SalomeApp_DoubleSpinBox::onEditingFinished ( )
protectedslot

References myTextValue, and setText().

void SalomeApp_DoubleSpinBox::onTextChanged ( const QString &  text)
protectedslot
void SalomeApp_DoubleSpinBox::setAcceptNames ( const bool  flag)
Parameters
flagIf true, variable names are enabled.

References myAcceptNames.

void SalomeApp_DoubleSpinBox::setDefaultValue ( const double  value)
virtual
Parameters
valuedefault value

References myDefaultValue.

void SalomeApp_DoubleSpinBox::setRange ( double  min,
double  max 
)
virtual
Parameters
minminimum value
maxmaximum value

References myIsRangeSet, myMaximum, and myMinimum.

void SalomeApp_DoubleSpinBox::setShowTipOnValidate ( const bool  flag)
Parameters
flagIf true, tooltips are enabled.

References myShowTip.

void SalomeApp_DoubleSpinBox::setText ( const QString &  value)
virtual
Parameters
valuecurrent value
void SalomeApp_DoubleSpinBox::setValue ( double  value)
virtual
Parameters
valuecurrent value

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

void SalomeApp_DoubleSpinBox::showEvent ( QShowEvent *  )
protectedvirtual

References myTextValue, and setText().

void SalomeApp_DoubleSpinBox::stepBy ( int  steps)
virtual

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

void SalomeApp_DoubleSpinBox::textChanged ( const QString &  )
signal
QString SalomeApp_DoubleSpinBox::textFromValue ( double  val) const
virtual
Parameters
valspin box value
Returns
text representation of the value
See Also
valueFromText()

Reimplemented from QtxDoubleSpinBox.

References QtxDoubleSpinBox::textFromValue().

QValidator::State SalomeApp_DoubleSpinBox::validate ( QString &  str,
int &  pos 
) const
virtual
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().

double SalomeApp_DoubleSpinBox::valueFromText ( const QString &  text) const
virtual
Parameters
texttext entered by the user
Returns
mapped value
See Also
textFromValue()

Reimplemented from QtxDoubleSpinBox.

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

Member Data Documentation

bool SalomeApp_DoubleSpinBox::myAcceptNames
private
QString SalomeApp_DoubleSpinBox::myCorrectValue
private
double SalomeApp_DoubleSpinBox::myDefaultValue
private
bool SalomeApp_DoubleSpinBox::myIsRangeSet
private
double SalomeApp_DoubleSpinBox::myMaximum
private
double SalomeApp_DoubleSpinBox::myMinimum
private
bool SalomeApp_DoubleSpinBox::myShowTip
private
QString SalomeApp_DoubleSpinBox::myTextValue
private

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