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

QtxIntSpinBox Class Reference

Enhanced version of the Qt's spin box. More...

#include <QtxIntSpinBox.h>

Inheritance diagram for QtxIntSpinBox:
Inheritance graph

Public Member Functions

 QtxIntSpinBox (QWidget *=0)
 Constructor.
 QtxIntSpinBox (int, int, int=1, QWidget *=0)
 Constructor.
virtual ~QtxIntSpinBox ()
 Destructor.
bool isCleared () const
 Check if spin box is in the "cleared" state.
virtual void setCleared (const bool)
 Change "cleared" status of the spin box.
virtual void stepBy (int)
 Perform steps increment/decrement steps.

Protected Slots

virtual void onTextChanged (const QString &)
 Called when user enters the text in the spin box.

Protected Member Functions

virtual QString textFromValue (int) const
 Convert value to the text.

Private Attributes

bool myCleared

Detailed Description

The QtxIntSpinBox class represents the widget for entering the integer values. In addition to the functionality provided by QSpinBox, this class supports "cleared" state - this is the state corresponding to "None" (or empty) entered value.

To set "cleared" state use setCleared() method. To check if the spin box stores "cleared" state, use isCleared() method. For example:

  if (mySpinBox->isCleared()) {
    ... // process "None" state
  }
  else {
    int value = mySpinBox->value();
    ... // process entered value
  }

Constructor & Destructor Documentation

QtxIntSpinBox::QtxIntSpinBox ( 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 onTextChanged().

QtxIntSpinBox::QtxIntSpinBox ( int  min,
int  max,
int  step = 1,
QWidget parent = 0 
)

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

References onTextChanged().

QtxIntSpinBox::~QtxIntSpinBox ( ) [virtual]

Member Function Documentation

bool QtxIntSpinBox::isCleared ( ) const
Returns:
true if spin box is cleared

References myCleared.

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

References myCleared.

void QtxIntSpinBox::stepBy ( int  steps) [virtual]

The steps value can be any integer number. If it is > 0, the value incrementing is done, otherwise value is decremented steps times.

Parameters:
stepsnumber of increment/decrement steps

Reimplemented in SalomeApp_IntSpinBox.

References myCleared.

void QtxIntSpinBox::onTextChanged ( const QString &  ) [protected, virtual, slot]
Parameters:
txtcurrent spin box text (not used)

Reimplemented in SalomeApp_IntSpinBox.

References myCleared.

QString QtxIntSpinBox::textFromValue ( int  val) const [protected, virtual]
Parameters:
valvalue being converted
Returns:
string containing the converted value

Reimplemented in SalomeApp_IntSpinBox.

References myCleared.


Field Documentation

bool QtxIntSpinBox.myCleared [private]
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