Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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. More...
 
 SalomeApp_IntSpinBox (int, int, int=1, QWidget *=0, bool=true, bool=true)
 Constructor. More...
 
virtual ~SalomeApp_IntSpinBox ()
 Destructor. More...
 
virtual void stepBy (int)
 Perform steps increment/decrement steps. More...
 
virtual int valueFromText (const QString &) const
 Interpret text entered by the user as a value. More...
 
virtual QString textFromValue (int) 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 int)
 This function is used to set a default value for this spinbox. More...
 
virtual void setValue (int)
 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 QtxIntSpinBox
 QtxIntSpinBox (QWidget *=0)
 Constructor. More...
 
 QtxIntSpinBox (int, int, int=1, QWidget *=0)
 Constructor. More...
 
virtual ~QtxIntSpinBox ()
 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...
 

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 QtxIntSpinBox
virtual void onTextChanged (const QString &)
 Called when user enters the text in the spin box. More...
 

Protected Member Functions

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

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

int myDefaultValue
 
QString myCorrectValue
 
QString myTextValue
 
bool myAcceptNames
 
bool myShowTip
 

Member Enumeration Documentation

Enumerator
NotFound 
IncorrectType 
Found 
Enumerator
Invalid 
NoVariable 
Incompatible 
Acceptable 

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

bool SalomeApp_IntSpinBox::checkRange ( const int  value) const
protected
Returns
check status
void SalomeApp_IntSpinBox::connectSignalsAndSlots ( )
private
int SalomeApp_IntSpinBox::defaultValue ( ) const
protected
Returns
default acceptable value

References myDefaultValue.

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

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

bool SalomeApp_IntSpinBox::isAcceptNames ( ) const

References myAcceptNames.

bool SalomeApp_IntSpinBox::isShowTipOnValidate ( ) const

References myShowTip.

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

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

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.

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

References myTextValue, and setText().

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

References myAcceptNames.

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

References myDefaultValue.

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

References myShowTip.

void SalomeApp_IntSpinBox::setText ( const QString &  value)
virtual
Parameters
valuecurrent value
void SalomeApp_IntSpinBox::setValue ( int  value)
virtual
Parameters
valuecurrent value

References myCorrectValue, and myTextValue.

void SalomeApp_IntSpinBox::showEvent ( QShowEvent *  )
protectedvirtual

References myTextValue, and setText().

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.

References QtxIntSpinBox::stepBy().

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

Reimplemented from QtxIntSpinBox.

References QtxIntSpinBox::textFromValue().

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

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

Member Data Documentation

bool SalomeApp_IntSpinBox::myAcceptNames
private
QString SalomeApp_IntSpinBox::myCorrectValue
private
int SalomeApp_IntSpinBox::myDefaultValue
private
bool SalomeApp_IntSpinBox::myShowTip
private
QString SalomeApp_IntSpinBox::myTextValue
private

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