You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
176 lines
8.5 KiB
176 lines
8.5 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQIntValidator Class</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQIntValidator Class Reference</h1>
|
|
|
|
<p>The TQIntValidator class provides a validator which ensures
|
|
that a string contains a valid integer within a specified range.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="tqvalidator-h.html">tqvalidator.h</a>></tt>
|
|
<p>Inherits <a href="tqvalidator.html">TQValidator</a>.
|
|
<p><a href="tqintvalidator-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQIntValidator"><b>TQIntValidator</b></a> ( TQObject * parent, const char * name = 0 )</li>
|
|
<li class=fn><a href="#TQIntValidator-2"><b>TQIntValidator</b></a> ( int minimum, int maximum, TQObject * parent, const char * name = 0 )</li>
|
|
<li class=fn><a href="#~TQIntValidator"><b>~TQIntValidator</b></a> ()</li>
|
|
<li class=fn>virtual TQValidator::State <a href="#validate"><b>validate</b></a> ( TQString & input, int & ) const</li>
|
|
<li class=fn>void <a href="#setBottom"><b>setBottom</b></a> ( int )</li>
|
|
<li class=fn>void <a href="#setTop"><b>setTop</b></a> ( int )</li>
|
|
<li class=fn>virtual void <a href="#setRange"><b>setRange</b></a> ( int bottom, int top )</li>
|
|
<li class=fn>int <a href="#bottom"><b>bottom</b></a> () const</li>
|
|
<li class=fn>int <a href="#top"><b>top</b></a> () const</li>
|
|
</ul>
|
|
<h2>Properties</h2>
|
|
<ul>
|
|
<li class=fn>int <a href="#bottom-prop"><b>bottom</b></a> - the validator's lowest acceptable value</li>
|
|
<li class=fn>int <a href="#top-prop"><b>top</b></a> - the validator's highest acceptable value</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQIntValidator class provides a validator which ensures
|
|
that a string contains a valid integer within a specified range.
|
|
<p>
|
|
<p> Example of use:
|
|
<p> <pre>
|
|
<a href="tqvalidator.html">TQValidator</a>* validator = new TQIntValidator( 100, 999, this );
|
|
<a href="tqlineedit.html">TQLineEdit</a>* edit = new <a href="tqlineedit.html">TQLineEdit</a>( this );
|
|
|
|
// the edit lineedit will only accept integers between 100 and 999
|
|
edit-><a href="tqlineedit.html#setValidator">setValidator</a>( validator );
|
|
</pre>
|
|
|
|
<p> Below we present some examples of validators. In practice they would
|
|
normally be associated with a widget as in the example above.
|
|
<p> <pre>
|
|
<a href="tqstring.html">TQString</a> str;
|
|
int pos = 0;
|
|
TQIntValidator v( 100, 999, this );
|
|
|
|
str = "1";
|
|
v.<a href="#validate">validate</a>( str, pos ); // returns Intermediate
|
|
str = "12";
|
|
v.<a href="#validate">validate</a>( str, pos ); // returns Intermediate
|
|
|
|
str = "123";
|
|
v.<a href="#validate">validate</a>( str, pos ); // returns Acceptable
|
|
str = "678";
|
|
v.<a href="#validate">validate</a>( str, pos ); // returns Acceptable
|
|
|
|
str = "1234";
|
|
v.<a href="#validate">validate</a>( str, pos ); // returns Invalid
|
|
str = "-123";
|
|
v.<a href="#validate">validate</a>( str, pos ); // returns Invalid
|
|
str = "abc";
|
|
v.<a href="#validate">validate</a>( str, pos ); // returns Invalid
|
|
str = "12cm";
|
|
v.<a href="#validate">validate</a>( str, pos ); // returns Invalid
|
|
</pre>
|
|
|
|
<p> The minimum and maximum values are set in one call with <a href="#setRange">setRange</a>()
|
|
or individually with <a href="#setBottom">setBottom</a>() and <a href="#setTop">setTop</a>().
|
|
<p> <p>See also <a href="tqdoublevalidator.html">TQDoubleValidator</a>, <a href="tqregexpvalidator.html">TQRegExpValidator</a>, and <a href="misc.html">Miscellaneous Classes</a>.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQIntValidator"></a>TQIntValidator::TQIntValidator ( <a href="tqobject.html">TQObject</a> * parent, const char * name = 0 )
|
|
</h3>
|
|
Constructs a validator called <em>name</em> with parent <em>parent</em>, that
|
|
accepts all integers.
|
|
|
|
<h3 class=fn><a name="TQIntValidator-2"></a>TQIntValidator::TQIntValidator ( int minimum, int maximum, <a href="tqobject.html">TQObject</a> * parent, const char * name = 0 )
|
|
</h3>
|
|
Constructs a validator called <em>name</em> with parent <em>parent</em>, that
|
|
accepts integers from <em>minimum</em> to <em>maximum</em> inclusive.
|
|
|
|
<h3 class=fn><a name="~TQIntValidator"></a>TQIntValidator::~TQIntValidator ()
|
|
</h3>
|
|
Destroys the validator, freeing any resources allocated.
|
|
|
|
<h3 class=fn>int <a name="bottom"></a>TQIntValidator::bottom () const
|
|
</h3><p>Returns the validator's lowest acceptable value.
|
|
See the <a href="tqintvalidator.html#bottom-prop">"bottom"</a> property for details.
|
|
<h3 class=fn>void <a name="setBottom"></a>TQIntValidator::setBottom ( int )
|
|
</h3><p>Sets the validator's lowest acceptable value.
|
|
See the <a href="tqintvalidator.html#bottom-prop">"bottom"</a> property for details.
|
|
<h3 class=fn>void <a name="setRange"></a>TQIntValidator::setRange ( int bottom, int top )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the range of the validator to only accept integers between <em>bottom</em> and <em>top</em> inclusive.
|
|
|
|
<h3 class=fn>void <a name="setTop"></a>TQIntValidator::setTop ( int )
|
|
</h3><p>Sets the validator's highest acceptable value.
|
|
See the <a href="tqintvalidator.html#top-prop">"top"</a> property for details.
|
|
<h3 class=fn>int <a name="top"></a>TQIntValidator::top () const
|
|
</h3><p>Returns the validator's highest acceptable value.
|
|
See the <a href="tqintvalidator.html#top-prop">"top"</a> property for details.
|
|
<h3 class=fn><a href="tqvalidator.html#State-enum">TQValidator::State</a> <a name="validate"></a>TQIntValidator::validate ( <a href="tqstring.html">TQString</a> & input, int & ) const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns <a href="tqvalidator.html#State-enum">Acceptable</a> if the <em>input</em> is an integer within the
|
|
valid range, <a href="tqvalidator.html#State-enum">Intermediate</a> if the <em>input</em> is an integer outside
|
|
the valid range and <a href="tqvalidator.html#State-enum">Invalid</a> if the <em>input</em> is not an integer.
|
|
<p> Note: If the valid range consists of just positive integers (e.g. 32 - 100)
|
|
and <em>input</em> is a negative integer then Invalid is returned.
|
|
<p> <pre>
|
|
int pos = 0;
|
|
s = "abc";
|
|
v.validate( s, pos ); // returns Invalid
|
|
|
|
s = "5";
|
|
v.validate( s, pos ); // returns Intermediate
|
|
|
|
s = "50";
|
|
v.validate( s, pos ); // returns Valid
|
|
</pre>
|
|
|
|
|
|
<p>Reimplemented from <a href="tqvalidator.html#validate">TQValidator</a>.
|
|
<hr><h2>Property Documentation</h2>
|
|
<h3 class=fn>int <a name="bottom-prop"></a>bottom</h3>
|
|
<p>This property holds the validator's lowest acceptable value.
|
|
<p>Set this property's value with <a href="#setBottom">setBottom</a>() and get this property's value with <a href="#bottom">bottom</a>().
|
|
<p><p>See also <a href="#setRange">setRange</a>().
|
|
|
|
<h3 class=fn>int <a name="top-prop"></a>top</h3>
|
|
<p>This property holds the validator's highest acceptable value.
|
|
<p>Set this property's value with <a href="#setTop">setTop</a>() and get this property's value with <a href="#top">top</a>().
|
|
<p><p>See also <a href="#setRange">setRange</a>().
|
|
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|