📄 qintvalidator.3qt
字号:
'\" t.TH QIntValidator 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQIntValidator \- Validator which ensures that a string contains a valid integer within a specified range.SH SYNOPSIS\fC#include <qvalidator.h>\fR.PPInherits QValidator..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQIntValidator\fR ( QObject * parent, const char * name = 0 )".br.ti -1c.BI "\fBQIntValidator\fR ( int minimum, int maximum, QObject * parent, const char * name = 0 )".br.ti -1c.BI "\fB~QIntValidator\fR ()".br.ti -1c.BI "virtual QValidator::State \fBvalidate\fR ( QString & input, int & ) const".br.ti -1c.BI "void \fBsetBottom\fR ( int )".br.ti -1c.BI "void \fBsetTop\fR ( int )".br.ti -1c.BI "virtual void \fBsetRange\fR ( int minimum, int maximum )".br.ti -1c.BI "int \fBbottom\fR () const".br.ti -1c.BI "int \fBtop\fR () const".br.in -1c.SS "Properties".in +1c.ti -1c.BI "int \fBbottom\fR - the validator's lowest acceptable value".br.ti -1c.BI "int \fBtop\fR - the validator's highest acceptable value".br.in -1c.SH DESCRIPTIONThe QIntValidator class provides a validator which ensures that a string contains a valid integer within a specified range..PPThe validate() function returns Acceptable, Intermediate or Invalid. Acceptable means that the string is a valid integer within the specified range. Intermediate means that the string is a valid integer but is not within the specified range. Invalid means that the string is not a valid integer..PPExample of use:.PP.nf.br QIntValidator v( 0, 100, this );.br QLineEdit* edit = new QLineEdit( this );.br.br // the edit lineedit will only accept integers between 0 and 100.br edit->setValidator( &v );.br.fi.PPBelow we present some examples of validators. In practice they would normally be associated with a widget as in the example above..PP.nf.br QString s;.br QIntValidator v( 0, 100, this );.br.br s = "10";.br v.validate( s, 0 ); // returns Acceptable.br s = "35";.br v.validate( s, 0 ); // returns Acceptable.br.br s = "105";.br v.validate( s, 0 ); // returns Intermediate.br.br s = "-763";.br v.validate( s, 0 ); // returns Invalid.br s = "abc";.br v.validate( s, 0 ); // returns Invalid.br s = "12v";.br v.validate( s, 0 ); // returns Invalid.br.fi.PPThe minimum and maximum values are set in one call with setRange() or individually with setBottom() and setTop()..PPSee also QDoubleValidator, QRegExpValidator, and Miscellaneous Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QIntValidator::QIntValidator ( QObject * parent, const char * name = 0 )"Constructs a validator called \fIname\fR with parent \fIparent\fR, that accepts all integers..SH "QIntValidator::QIntValidator ( int minimum, int maximum, QObject * parent, const char * name = 0 )"Constructs a validator called \fIname\fR with parent \fIparent\fR, that accepts integers from \fIminimum\fR to \fImaximum\fR inclusive..SH "QIntValidator::~QIntValidator ()"Destroys the validator, freeing any resources allocated..SH "int QIntValidator::bottom () const"Returns the validator's lowest acceptable value. See the "bottom" property for details..SH "void QIntValidator::setBottom ( int )"Sets the validator's lowest acceptable value. See the "bottom" property for details..SH "void QIntValidator::setRange ( int minimum, int maximum )\fC [virtual]\fR"Sets the range of the validator to only accept integers between \fIminimum\fR and \fImaximum\fR inclusive..SH "void QIntValidator::setTop ( int )"Sets the validator's highest acceptable value. See the "top" property for details..SH "int QIntValidator::top () const"Returns the validator's highest acceptable value. See the "top" property for details..SH "QValidator::State QIntValidator::validate ( QString & input, int & ) const\fC [virtual]\fR"Returns Acceptable if the \fIinput\fR is an integer within the valid range, Intermediate if the \fIinput\fR is an integer outside the valid range and Invalid if the \fIinput\fR is not an integer..PP.nf.br s = "35";.br v.validate( s, 0 ); // returns Acceptable.br.br s = "105";.br v.validate( s, 0 ); // returns Intermediate.br.br s = "abc";.br v.validate( s, 0 ); // returns Invalid.br.fi.PPReimplemented from QValidator..SS "Property Documentation".SH "int bottom"This property holds the validator's lowest acceptable value..PPSet this property's value with setBottom() and get this property's value with bottom()..PPSee also setRange()..SH "int top"This property holds the validator's highest acceptable value..PPSet this property's value with setTop() and get this property's value with top()..PPSee also setRange()..SH "SEE ALSO".BR http://doc.trolltech.com/qintvalidator.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qintvalidator.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -