Version: 6.3.1
Signals | Public Member Functions | Protected Slots | Protected Member Functions | Private Types | Private Member Functions | Private Attributes

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

Protected Slots

void onEditingFinished ()
 This function is called when editing is finished.
void onTextChanged (const QString &)
 This function is called when value is changed.

Protected Member Functions

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

Private Types

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

Private Member Functions

void connectSignalsAndSlots ()
 Connect signals and slots.

Private Attributes

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

Member Enumeration Documentation

Enumerator:
Invalid 
NoVariable 
Incompatible 
Acceptable 
Enumerator:
NotFound 
IncorrectType 
Found 

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

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.

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

QString SalomeApp_DoubleSpinBox::textFromValue ( double  val) const [virtual]
Parameters:
valspin box value
Returns:
text representation of the value
See also:
valueFromText()

Reimplemented from QtxDoubleSpinBox.

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(), Invalid, isAcceptNames(), isShowTipOnValidate(), and textFromValue().

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

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

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::setValue ( double  value) [virtual]
Parameters:
valuecurrent value

References myCorrectValue, myTextValue, and textFromValue().

void SalomeApp_DoubleSpinBox::setText ( const QString &  value) [virtual]
Parameters:
valuecurrent value
void SalomeApp_DoubleSpinBox::setAcceptNames ( const bool  flag)
Parameters:
flagIf true, variable names are enabled.

References myAcceptNames.

bool SalomeApp_DoubleSpinBox::isAcceptNames ( ) const

References myAcceptNames.

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

References myShowTip.

bool SalomeApp_DoubleSpinBox::isShowTipOnValidate ( ) const

References myShowTip.

void SalomeApp_DoubleSpinBox.textChanged ( const QString &  ) [signal]
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.

double SalomeApp_DoubleSpinBox::defaultValue ( ) const [protected]
Returns:
default acceptable value

References myDefaultValue, myMaximum, and myMinimum.

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

References myIsRangeSet, myMaximum, and myMinimum.

SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable ( const QString &  name,
double &  value 
) const [protected]
void SalomeApp_DoubleSpinBox::keyPressEvent ( QKeyEvent *  e) [protected, virtual]
void SalomeApp_DoubleSpinBox::showEvent ( QShowEvent *  ) [protected, virtual]

References myTextValue, and setText().

void SalomeApp_DoubleSpinBox::onEditingFinished ( ) [protected, slot]

References myTextValue, and setText().

void SalomeApp_DoubleSpinBox::onTextChanged ( const QString &  text) [protected, virtual, slot]

Reimplemented from QtxDoubleSpinBox.

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

void SalomeApp_DoubleSpinBox::connectSignalsAndSlots ( ) [private]
bool QtxDoubleSpinBox::isCleared ( ) const [inherited]
Returns:
true if spin box is cleared
See also:
setCleared()

References QtxDoubleSpinBox.myCleared.

void QtxDoubleSpinBox::setCleared ( const bool  on) [virtual, inherited]
Parameters:
onnew "cleared" status
See also:
isCleared()

References QtxDoubleSpinBox.myCleared.

int QtxDoubleSpinBox::getPrecision ( ) const [inherited]
Returns:
current prevision value
See also:
setPrecision()

References QtxDoubleSpinBox.myPrecision.

void QtxDoubleSpinBox::setPrecision ( const int  prec) [inherited]

If precision value is less than 0, the 'g' format is used for value output, otherwise 'f' format is used.

Parameters:
precnew precision value.
See also:
precision()

References QtxDoubleSpinBox.myPrecision.

QString QtxDoubleSpinBox::removeTrailingZeroes ( const QString &  src) const [protected, inherited]
Parameters:
strsource string
Returns:
resulting string

Field Documentation

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS