File: qdoublevalidator.html

package info (click to toggle)
qt4-x11 4%3A4.8.2%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 701,696 kB
  • sloc: cpp: 2,686,179; ansic: 375,485; python: 25,859; sh: 19,349; xml: 17,091; perl: 14,765; yacc: 5,383; asm: 5,038; makefile: 1,259; lex: 555; ruby: 526; objc: 347; cs: 112; pascal: 112; php: 54; sed: 34
file content (217 lines) | stat: -rw-r--r-- 16,847 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qvalidator.cpp -->
  <title>Qt 4.8: QDoubleValidator Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QDoubleValidator</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QDoubleValidator Class Reference</h1>
<!-- $$$QDoubleValidator-brief -->
<p>The QDoubleValidator class provides range checking of floating-point numbers. <a href="#details">More...</a></p>
<!-- @@@QDoubleValidator -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QDoubleValidator&gt;</span></pre><p><b>Inherits: </b><a href="qvalidator.html">QValidator</a>.</p>
<ul>
<li><a href="qdoublevalidator-members.html">List of all members, including inherited members</a></li>
<li><a href="qdoublevalidator-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#Notation-enum">Notation</a></b> { StandardNotation, ScientificNotation }</td></tr>
</table>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><a href="qdoublevalidator.html#bottom-prop">bottom</a></b> : double</li>
<li class="fn"><b><a href="qdoublevalidator.html#decimals-prop">decimals</a></b> : int</li>
<li class="fn"><b><a href="qdoublevalidator.html#notation-prop">notation</a></b> : Notation</li>
<li class="fn"><b><a href="qdoublevalidator.html#top-prop">top</a></b> : double</li>
</ul>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#QDoubleValidator">QDoubleValidator</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#QDoubleValidator-2">QDoubleValidator</a></b> ( double <i>bottom</i>, double <i>top</i>, int <i>decimals</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#dtor.QDoubleValidator">~QDoubleValidator</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> double </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#bottom-prop">bottom</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#decimals-prop">decimals</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Notation </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#notation-prop">notation</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#bottom-prop">setBottom</a></b> ( double )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#decimals-prop">setDecimals</a></b> ( int )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#notation-prop">setNotation</a></b> ( Notation )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#setRange">setRange</a></b> ( double <i>minimum</i>, double <i>maximum</i>, int <i>decimals</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#top-prop">setTop</a></b> ( double )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> double </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#top-prop">top</a></b> () const</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QValidator::State </td><td class="memItemRight bottomAlign"><b><a href="qdoublevalidator.html#validate">validate</a></b> ( QString &amp; <i>input</i>, int &amp; <i>pos</i> ) const</td></tr>
</table>
<ul>
<li class="fn">4 public functions inherited from <a href="qvalidator.html#public-functions">QValidator</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QDoubleValidator-description -->
<div class="descr">
<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, &quot;1,234&quot; 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 &quot;C&quot; locale. QDoubleValidator will not accept numbers with thousand-separators.</p>
</div>
<p><b>See also </b><a href="qintvalidator.html">QIntValidator</a>, <a href="qregexpvalidator.html">QRegExpValidator</a>, and <a href="widgets-lineedits.html">Line Edits Example</a>.</p>
<!-- @@@QDoubleValidator -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Notation$$$StandardNotation$$$ScientificNotation -->
<h3 class="fn"><a name="Notation-enum"></a>enum QDoubleValidator::<span class="name">Notation</span></h3>
<p>This enum defines the allowed notations for entering a double.</p>
<table class="valuelist"><tr valign="top" class="odd"><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&#x2e; 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&#x2e; 1.5E-2).</td></tr>
</table>
<p>This enum was introduced or modified in Qt 4.3.</p>
<!-- @@@Notation -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$bottom-prop$$$bottom$$$setBottomdouble -->
<h3 class="fn"><a name="bottom-prop"></a><span class="name">bottom</span> : <span class="type">double</span></h3>
<p>This property holds the validator's minimum acceptable value.</p>
<p>By default, this property contains a value of -infinity.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> double </td><td class="memItemRight bottomAlign"><span class="name"><b>bottom</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setBottom</b></span> ( double )</td></tr>
</table>
<p><b>See also </b><a href="qdoublevalidator.html#setRange">setRange</a>().</p>
<!-- @@@bottom -->
<!-- $$$decimals-prop$$$decimals$$$setDecimalsint -->
<h3 class="fn"><a name="decimals-prop"></a><span class="name">decimals</span> : <span class="type">int</span></h3>
<p>This property holds the validator's maximum number of digits after the decimal point.</p>
<p>By default, this property contains a value of 1000.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>decimals</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDecimals</b></span> ( int )</td></tr>
</table>
<p><b>See also </b><a href="qdoublevalidator.html#setRange">setRange</a>().</p>
<!-- @@@decimals -->
<!-- $$$notation-prop$$$notation$$$setNotationNotation -->
<h3 class="fn"><a name="notation-prop"></a><span class="name">notation</span> : <span class="type"><a href="qdoublevalidator.html#Notation-enum">Notation</a></span></h3>
<p>This property holds the notation of how a string can describe a number.</p>
<p>By default, this property is set to <a href="qdoublevalidator.html#Notation-enum">ScientificNotation</a>.</p>
<p>This property was introduced in Qt 4.3.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Notation </td><td class="memItemRight bottomAlign"><span class="name"><b>notation</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setNotation</b></span> ( Notation )</td></tr>
</table>
<p><b>See also </b><a href="qdoublevalidator.html#Notation-enum">Notation</a>.</p>
<!-- @@@notation -->
<!-- $$$top-prop$$$top$$$setTopdouble -->
<h3 class="fn"><a name="top-prop"></a><span class="name">top</span> : <span class="type">double</span></h3>
<p>This property holds the validator's maximum acceptable value.</p>
<p>By default, this property contains a value of infinity.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> double </td><td class="memItemRight bottomAlign"><span class="name"><b>top</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTop</b></span> ( double )</td></tr>
</table>
<p><b>See also </b><a href="qdoublevalidator.html#setRange">setRange</a>().</p>
<!-- @@@top -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QDoubleValidator[overload1]$$$QDoubleValidatorQObject* -->
<h3 class="fn"><a name="QDoubleValidator"></a>QDoubleValidator::<span class="name">QDoubleValidator</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a validator object with a <i>parent</i> object that accepts any double.</p>
<!-- @@@QDoubleValidator -->
<!-- $$$QDoubleValidator$$$QDoubleValidatordoubledoubleintQObject* -->
<h3 class="fn"><a name="QDoubleValidator-2"></a>QDoubleValidator::<span class="name">QDoubleValidator</span> ( <span class="type">double</span> <i>bottom</i>, <span class="type">double</span> <i>top</i>, <span class="type">int</span> <i>decimals</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<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>
<!-- @@@QDoubleValidator -->
<!-- $$$~QDoubleValidator[overload1]$$$~QDoubleValidator -->
<h3 class="fn"><a name="dtor.QDoubleValidator"></a>QDoubleValidator::<span class="name">~QDoubleValidator</span> ()</h3>
<p>Destroys the validator.</p>
<!-- @@@~QDoubleValidator -->
<!-- $$$setRange[overload1]$$$setRangedoubledoubleint -->
<h3 class="fn"><a name="setRange"></a><span class="type">void</span> QDoubleValidator::<span class="name">setRange</span> ( <span class="type">double</span> <i>minimum</i>, <span class="type">double</span> <i>maximum</i>, <span class="type">int</span> <i>decimals</i> = 0 )<tt> [virtual]</tt></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>
<!-- @@@setRange -->
<!-- $$$validate[overload1]$$$validateQString&int& -->
<h3 class="fn"><a name="validate"></a><span class="type"><a href="qvalidator.html#State-enum">QValidator::State</a></span> QDoubleValidator::<span class="name">validate</span> ( <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>input</i>, <span class="type">int</span> &amp; <i>pos</i> ) const<tt> [virtual]</tt></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&#x2e; 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&#x2e; 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>
<!-- @@@validate -->
</div>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>