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

SalomeApp_IntSpinBox Class Reference

#include <SalomeApp_IntSpinBox.h>

Inheritance diagram for SalomeApp_IntSpinBox:
Inheritance graph

Signals

void textChanged (const QString &)

Public Member Functions

 SalomeApp_IntSpinBox (QWidget *=0)
 Constructor.
 SalomeApp_IntSpinBox (int, int, int=1, QWidget *=0, bool=true, bool=true)
 Constructor.
virtual ~SalomeApp_IntSpinBox ()
 Destructor.
virtual void stepBy (int)
 Perform steps increment/decrement steps.
virtual int valueFromText (const QString &) const
 Interpret text entered by the user as a value.
virtual QString textFromValue (int) 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 int)
 This function is used to set a default value for this spinbox.
virtual void setValue (int)
 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.

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 &, int &) const
 This function is used to determine whether input is valid.
int defaultValue () const
 This function return a default acceptable value (commonly, 0).
bool checkRange (const int) const
 This function is used to check that string value lies within predefined range.
SearchState findVariable (const QString &, int &) 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.

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

int myDefaultValue
QString myCorrectValue
QString myTextValue
bool myAcceptNames
bool myShowTip

Member Enumeration Documentation

Enumerator:
Invalid 
NoVariable 
Incompatible 
Acceptable 
Enumerator:
NotFound 
IncorrectType 
Found 

Constructor & Destructor Documentation

SalomeApp_IntSpinBox::SalomeApp_IntSpinBox ( QWidget parent = 0)

Constructs a spin box with 0 as minimum value and 99 as maximum value, a step value of 1. The value is initially set to 0.

Parameters:
parentparent object

References connectSignalsAndSlots().

SalomeApp_IntSpinBox::SalomeApp_IntSpinBox ( int  min,
int  max,
int  step = 1,
QWidget parent = 0,
bool  acceptNames = true,
bool  showTip = true 
)

Constructs a spin box with specified minimum, maximum and step value. 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_IntSpinBox::~SalomeApp_IntSpinBox ( ) [virtual]

Member Function Documentation

void SalomeApp_IntSpinBox::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 QtxIntSpinBox.

int SalomeApp_IntSpinBox::valueFromText ( const QString &  text) const [virtual]
Parameters:
texttext entered by the user
Returns:
mapped value
See also:
textFromValue()

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

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

Reimplemented from QtxIntSpinBox.

QValidator::State SalomeApp_IntSpinBox::validate ( QString &  str,
int &  pos 
) const [virtual]
Parameters:
strcurrently entered value
poscursor position in the string
Returns:
validating operation result

References Invalid, isAcceptNames(), isShowTipOnValidate(), and textFromValue().

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

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

void SalomeApp_IntSpinBox::setDefaultValue ( const int  value) [virtual]
Parameters:
valuedefault value

References myDefaultValue.

void SalomeApp_IntSpinBox::setValue ( int  value) [virtual]
Parameters:
valuecurrent value

References myCorrectValue, and myTextValue.

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

References myAcceptNames.

bool SalomeApp_IntSpinBox::isAcceptNames ( ) const

References myAcceptNames.

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

References myShowTip.

bool SalomeApp_IntSpinBox::isShowTipOnValidate ( ) const

References myShowTip.

void SalomeApp_IntSpinBox.textChanged ( const QString &  ) [signal]
SalomeApp_IntSpinBox::State SalomeApp_IntSpinBox::isValid ( const QString &  text,
int &  value 
) const [protected]
Returns:
validating operation result

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

int SalomeApp_IntSpinBox::defaultValue ( ) const [protected]
Returns:
default acceptable value

References myDefaultValue.

bool SalomeApp_IntSpinBox::checkRange ( const int  value) const [protected]
Returns:
check status
SalomeApp_IntSpinBox::SearchState SalomeApp_IntSpinBox::findVariable ( const QString &  name,
int &  value 
) const [protected]
void SalomeApp_IntSpinBox::keyPressEvent ( QKeyEvent *  e) [protected, virtual]
void SalomeApp_IntSpinBox::showEvent ( QShowEvent *  ) [protected, virtual]

References myTextValue, and setText().

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

References myTextValue, and setText().

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

Reimplemented from QtxIntSpinBox.

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

void SalomeApp_IntSpinBox::connectSignalsAndSlots ( ) [private]
bool QtxIntSpinBox::isCleared ( ) const [inherited]
Returns:
true if spin box is cleared

References QtxIntSpinBox.myCleared.

void QtxIntSpinBox::setCleared ( const bool  on) [virtual, inherited]
Parameters:
onnew "cleared" status

References QtxIntSpinBox.myCleared.


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