Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QIntValidator

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.gui.QValidator
                      com.trolltech.qt.gui.QIntValidator

All Implemented Interfaces:
  QtJambiInterface

    public class QIntValidator

extends QValidator

The `QIntValidator` class provides a validator that ensures a string contains a valid integer within a specified range. Example of use:

        QValidator *validator = new QIntValidator(100, 999, this);
        QLineEdit *edit = new QLineEdit(this);

        // the edit lineedit will only accept integers between 100 and 999
        edit->setValidator(validator);

Below we present some examples of validators. In practice they would normally be associated with a widget as in the example above.

        QString str;
        int pos = 0;
        QIntValidator v(100, 999, this);

        str = "1";
        v.validate(str, pos);     // returns Intermediate
        str = "12";
        v.validate(str, pos);     // returns Intermediate

        str = "123";
        v.validate(str, pos);     // returns Acceptable
        str = "678";
        v.validate(str, pos);     // returns Acceptable

        str = "1234";
        v.validate(str, pos);     // returns Invalid
        str = "-123";
        v.validate(str, pos);     // returns Invalid
        str = "abc";
        v.validate(str, pos);     // returns Invalid
        str = "12cm";
        v.validate(str, pos);     // returns Invalid

The minimum and maximum values are set in one call with `setRange()`, or individually with `setBottom()` and `setTop()`.

`QIntValidator` uses its `locale()` to interpret the number. For example, in Arabic locales, `QIntValidator` will accept Arabic digits. In addition, `QIntValidator` is always guaranteed to accept a number formatted according to the "C" locale.

See also:
  `QDoubleValidator`, `QRegExpValidator`, and Line Edits Example.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QValidator
`QValidator.QValidationData, QValidator.State`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Constructor Summary
`QIntValidator(int bottom, int top, QObject parent)` Constructs a validator with a `parent`, that accepts integers from `minimum` to `maximum` inclusive.
`QIntValidator(QObject parent)` Constructs a validator with a `parent` object that accepts all integers.

Method Summary
`int` | `bottom()` This property holds the validator's lowest acceptable value.
`static QIntValidator` | `fromNativePointer(QNativePointer nativePointer)` This method returns the QIntValidator instance pointed to by `nativePointer`.
`void` | `setBottom(int arg__1)` This property holds the validator's lowest acceptable value.
`void` | `setRange(int bottom, int top)` Sets the range of the validator to only accept integers between `bottom` and `top` inclusive.
`void` | `setTop(int arg__1)` This property holds the validator's highest acceptable value.
`int` | `top()` This property holds the validator's highest acceptable value.

Methods inherited from class com.trolltech.qt.gui.QValidator
`fixup, locale, setLocale, validate`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QIntValidator

    public QIntValidator(QObject parent)

  Constructs a validator with a `parent` object that accepts all integers.

### QIntValidator

    public QIntValidator(int bottom,
                         int top,
                         QObject parent)

  Constructs a validator with a `parent`, that accepts integers from `minimum` to `maximum` inclusive.

Method Detail

### bottom

    public final int bottom()

  This property holds the validator's lowest acceptable value.

See also:
  `setRange()`.

### setBottom

    public final void setBottom(int arg__1)

  This property holds the validator's lowest acceptable value.

See also:
  `setRange()`.

### setTop

    public final void setTop(int arg__1)

  This property holds the validator's highest acceptable value.

See also:
  `setRange()`.

### top

    public final int top()

  This property holds the validator's highest acceptable value.

See also:
  `setRange()`.

### setRange

    public void setRange(int bottom,
                         int top)

  Sets the range of the validator to only accept integers between `bottom` and `top` inclusive.

### fromNativePointer

    public static QIntValidator fromNativePointer(QNativePointer nativePointer)

  This method returns the QIntValidator instance pointed to by `nativePointer`.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD