<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QDoubleValidator Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" 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="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDoubleValidator Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QDoubleValidator class provides range checking of floating-point numbers. <a href="#details">More...</a></p> <p>Inherits <a href="qvalidator.html">QValidator</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qdoublevalidator.html#Notation-enum">Notation</a></b> { StandardNotation, ScientificNotation }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdoublevalidator.html#QDoubleValidator">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qdoublevalidator.html#QDoubleValidator-2">__init__</a></b> (<i>self</i>, float <i>bottom</i>, float <i>top</i>, int <i>decimals</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />float <b><a href="qdoublevalidator.html#bottom">bottom</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdoublevalidator.html#decimals">decimals</a></b> (<i>self</i>)</li><li><div class="fn" />Notation <b><a href="qdoublevalidator.html#notation">notation</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdoublevalidator.html#setBottom">setBottom</a></b> (<i>self</i>, float)</li><li><div class="fn" /><b><a href="qdoublevalidator.html#setDecimals">setDecimals</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qdoublevalidator.html#setNotation">setNotation</a></b> (<i>self</i>, Notation)</li><li><div class="fn" /><b><a href="qdoublevalidator.html#setRange">setRange</a></b> (<i>self</i>, float <i>minimum</i>, float <i>maximum</i>, int <i>decimals</i> = 0)</li><li><div class="fn" /><b><a href="qdoublevalidator.html#setTop">setTop</a></b> (<i>self</i>, float)</li><li><div class="fn" />float <b><a href="qdoublevalidator.html#top">top</a></b> (<i>self</i>)</li><li><div class="fn" />(QValidator.State, QString, int) <b><a href="qdoublevalidator.html#validate">validate</a></b> (<i>self</i>, QString, int)</li><li><div class="fn" />(QValidator.State, int) <b><a href="qdoublevalidator.html#validate-2">validate</a></b> (<i>self</i>, QString, int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDoubleValidator class provides range checking of floating-point numbers.</p> <p>QDoubleValidator provides an upper bound, a lower bound, and a limit on the number of digits after the decimal point. It does not provide a <a href="qvalidator.html#fixup">fixup</a>() function.</p> <p>You can set the acceptable range in one call with <a href="qdoublevalidator.html#setRange">setRange</a>(), or with <a href="qdoublevalidator.html#bottom-prop">setBottom</a>() and <a href="qdoublevalidator.html#top-prop">setTop</a>(). Set the number of decimal places with <a href="qdoublevalidator.html#decimals-prop">setDecimals</a>(). The <a href="qdoublevalidator.html#validate">validate</a>() function returns the validation state.</p> <p>QDoubleValidator uses its <a href="qvalidator.html#locale">locale</a>() to interpret the number. For example, in the German locale, "1,234" will be accepted as the fractional number 1.234. In Arabic locales, QDoubleValidator will accept Arabic digits.</p> <p>In addition, QDoubleValidator is always guaranteed to accept a number formatted according to the "C" locale. QDoubleValidator will not accept numbers with thousand-separators.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Notation-enum" />QDoubleValidator.Notation</h3><p>This enum defines the allowed notations for entering a double.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"> <tt>QDoubleValidator.StandardNotation</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">The string is written as a standard number (i.e. 0.015).</td> </tr> <tr> <td class="topAlign"> <tt>QDoubleValidator.ScientificNotation</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">The string is written in scientific form. It may have an exponent part(i.e. 1.5E-2).</td> </tr> </table> <p>This enum was introduced or modified in Qt 4.3.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDoubleValidator" />QDoubleValidator.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a validator object with a <i>parent</i> object that accepts any double.</p> <h3 class="fn"><a name="QDoubleValidator-2" />QDoubleValidator.__init__ (<i>self</i>, float <i>bottom</i>, float <i>top</i>, int <i>decimals</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a validator object with a <i>parent</i> object. This validator will accept doubles from <i>bottom</i> to <i>top</i> inclusive, with up to <i>decimals</i> digits after the decimal point.</p> <h3 class="fn"><a name="bottom" />float QDoubleValidator.bottom (<i>self</i>)</h3><h3 class="fn"><a name="decimals" />int QDoubleValidator.decimals (<i>self</i>)</h3><h3 class="fn"><a name="notation" /><a href="qdoublevalidator.html#Notation-enum">Notation</a> QDoubleValidator.notation (<i>self</i>)</h3><h3 class="fn"><a name="setBottom" />QDoubleValidator.setBottom (<i>self</i>, float)</h3><h3 class="fn"><a name="setDecimals" />QDoubleValidator.setDecimals (<i>self</i>, int)</h3><h3 class="fn"><a name="setNotation" />QDoubleValidator.setNotation (<i>self</i>, <a href="qdoublevalidator.html#Notation-enum">Notation</a>)</h3><h3 class="fn"><a name="setRange" />QDoubleValidator.setRange (<i>self</i>, float <i>minimum</i>, float <i>maximum</i>, int <i>decimals</i> = 0)</h3><p>Sets the validator to accept doubles from <i>minimum</i> to <i>maximum</i> inclusive, with at most <i>decimals</i> digits after the decimal point.</p> <h3 class="fn"><a name="setTop" />QDoubleValidator.setTop (<i>self</i>, float)</h3><h3 class="fn"><a name="top" />float QDoubleValidator.top (<i>self</i>)</h3><h3 class="fn"><a name="validate" />(<a href="qvalidator.html#State-enum">QValidator.State</a>, QString, int) QDoubleValidator.validate (<i>self</i>, QString, int)</h3><p>Reimplemented from <a href="qvalidator.html#validate">QValidator.validate</a>().</p> <p>Returns <a href="qvalidator.html#State-enum">Acceptable</a> if the string <i>input</i> contains a double that is within the valid range and is in the correct format.</p> <p>Returns <a href="qvalidator.html#State-enum">Intermediate</a> if <i>input</i> contains a double that is outside the range or is in the wrong format; e.g. with too many digits after the decimal point or is empty.</p> <p>Returns <a href="qvalidator.html#State-enum">Invalid</a> if the <i>input</i> is not a double.</p> <p>Note: If the valid range consists of just positive doubles (e.g. 0.0 to 100.0) and <i>input</i> is a negative double then <a href="qvalidator.html#State-enum">Invalid</a> is returned. If <a href="qdoublevalidator.html#notation-prop">notation</a>() is set to <a href="qdoublevalidator.html#Notation-enum">StandardNotation</a>, and the input contains more digits before the decimal point than a double in the valid range may have, <a href="qvalidator.html#State-enum">Invalid</a> is returned. If <a href="qdoublevalidator.html#notation-prop">notation</a>() is <a href="qdoublevalidator.html#Notation-enum">ScientificNotation</a>, and the input is not in the valid range, <a href="qvalidator.html#State-enum">Intermediate</a> is returned. The value may yet become valid by changing the exponent.</p> <p>By default, the <i>pos</i> parameter is not used by this validator.</p> <h3 class="fn"><a name="validate-2" />(<a href="qvalidator.html#State-enum">QValidator.State</a>, int) QDoubleValidator.validate (<i>self</i>, QString, int)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>