|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QValidator
com.trolltech.qt.gui.QIntValidator
public class QIntValidator
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.
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.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Constructor Summary | |
---|---|
QIntValidator(int bottom,
int top,
QObject parent)
Constructs a validator with a parent, that accepts integers from bottom to top inclusive. |
|
QIntValidator(QObject parent)
Constructs a validator with a parent object that accepts all integers. |
Method Summary | |
---|---|
int |
bottom()
Returns the validator's lowest acceptable value. |
static QIntValidator |
fromNativePointer(QNativePointer nativePointer)
This function returns the QIntValidator instance pointed to by nativePointer |
void |
setBottom(int arg__1)
Sets the validator's lowest acceptable value to arg__1. |
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)
Sets the validator's highest acceptable value to arg__1. |
int |
top()
Returns the validator's highest acceptable value. |
QValidator.State |
validate(QValidator.QValidationData arg__1)
Equivalent to validate(arg__1, ). |
Methods inherited from class com.trolltech.qt.gui.QValidator |
---|
fixup, locale, setLocale |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
disconnect, disconnect, signalSender |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QIntValidator(int bottom, int top, QObject parent)
Constructs a validator with a parent, that accepts integers from bottom to top inclusive.
public QIntValidator(QObject parent)
Constructs a validator with a parent object that accepts all integers.
Method Detail |
---|
public final int bottom()
Returns the validator's lowest acceptable value.
public final void setBottom(int arg__1)
Sets the validator's lowest acceptable value to arg__1.
public final void setTop(int arg__1)
Sets the validator's highest acceptable value to arg__1.
public final int top()
Returns the validator's highest acceptable value.
public void setRange(int bottom, int top)
Sets the range of the validator to only accept integers between bottom and top inclusive.
public QValidator.State validate(QValidator.QValidationData arg__1)
Equivalent to validate(arg__1, ).
validate
in class QValidator
public static QIntValidator fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |