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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
|
<?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" />
<!-- qspinbox.cpp -->
<title>Qt 4.8: QSpinBox 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>QSpinBox</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<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="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#subclassing-qspinbox">Subclassing QSpinBox</a></li>
</ul>
</div>
<h1 class="title">QSpinBox Class Reference</h1>
<!-- $$$QSpinBox-brief -->
<p>The QSpinBox class provides a spin box widget. <a href="#details">More...</a></p>
<!-- @@@QSpinBox -->
<pre class="cpp"> <span class="preprocessor">#include <QSpinBox></span></pre><p><b>Inherits: </b><a href="qabstractspinbox.html">QAbstractSpinBox</a>.</p>
<ul>
<li><a href="qspinbox-members.html">List of all members, including inherited members</a></li>
<li><a href="qspinbox-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qspinbox.html#cleanText-prop">cleanText</a></b> : const QString</li>
<li class="fn"><b><a href="qspinbox.html#maximum-prop">maximum</a></b> : int</li>
<li class="fn"><b><a href="qspinbox.html#minimum-prop">minimum</a></b> : int</li>
<li class="fn"><b><a href="qspinbox.html#prefix-prop">prefix</a></b> : QString</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qspinbox.html#singleStep-prop">singleStep</a></b> : int</li>
<li class="fn"><b><a href="qspinbox.html#suffix-prop">suffix</a></b> : QString</li>
<li class="fn"><b><a href="qspinbox.html#value-prop">value</a></b> : int</li>
</ul>
</td></tr>
</table>
<ul>
<li class="fn">11 properties inherited from <a href="qabstractspinbox.html#properties">QAbstractSpinBox</a></li>
<li class="fn">58 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<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="qspinbox.html#QSpinBox">QSpinBox</a></b> ( QWidget * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#cleanText-prop">cleanText</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#maximum-prop">maximum</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#minimum-prop">minimum</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#prefix-prop">prefix</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#maximum-prop">setMaximum</a></b> ( int <i>max</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#minimum-prop">setMinimum</a></b> ( int <i>min</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#prefix-prop">setPrefix</a></b> ( const QString & <i>prefix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#setRange">setRange</a></b> ( int <i>minimum</i>, int <i>maximum</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#singleStep-prop">setSingleStep</a></b> ( int <i>val</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#suffix-prop">setSuffix</a></b> ( const QString & <i>suffix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#singleStep-prop">singleStep</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#suffix-prop">suffix</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#value-prop">value</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">28 public functions inherited from <a href="qabstractspinbox.html#public-functions">QAbstractSpinBox</a></li>
<li class="fn">221 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li class="fn">13 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#value-prop">setValue</a></b> ( int <i>val</i> )</td></tr>
</table>
<ul>
<li class="fn">4 public slots inherited from <a href="qabstractspinbox.html#public-slots">QAbstractSpinBox</a></li>
<li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#valueChanged">valueChanged</a></b> ( int <i>i</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#valueChanged-2">valueChanged</a></b> ( const QString & <i>text</i> )</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qabstractspinbox.html#signals">QAbstractSpinBox</a></li>
<li class="fn">1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#textFromValue">textFromValue</a></b> ( int <i>value</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#valueFromText">valueFromText</a></b> ( const QString & <i>text</i> ) const</td></tr>
</table>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#event">event</a></b> ( QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#fixup">fixup</a></b> ( QString & <i>input</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QValidator::State </td><td class="memItemRight bottomAlign"><b><a href="qspinbox.html#validate">validate</a></b> ( QString & <i>text</i>, int & <i>pos</i> ) const</td></tr>
</table>
<ul>
<li class="fn">20 protected functions inherited from <a href="qabstractspinbox.html#protected-functions">QAbstractSpinBox</a></li>
<li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<!-- $$$QSpinBox-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QSpinBox class provides a spin box widget.</p>
<p>QSpinBox is designed to handle integers and discrete sets of values (e.g., month names); use <a href="qdoublespinbox.html">QDoubleSpinBox</a> for floating point values.</p>
<p>QSpinBox allows the user to choose a value by clicking the up/down buttons or pressing up/down on the keyboard to increase/decrease the value currently displayed. The user can also type the value in manually. The spin box supports integer values but can be extended to use different strings with <a href="qspinbox.html#validate">validate</a>(), <a href="qspinbox.html#textFromValue">textFromValue</a>() and <a href="qspinbox.html#valueFromText">valueFromText</a>().</p>
<p>Every time the value changes QSpinBox emits the <a href="qspinbox.html#valueChanged">valueChanged</a>() signals. The current value can be fetched with <a href="qspinbox.html#value-prop">value</a>() and set with <a href="qspinbox.html#value-prop">setValue</a>().</p>
<p>Clicking the up/down buttons or using the keyboard accelerator's up and down arrows will increase or decrease the current value in steps of size <a href="qspinbox.html#singleStep-prop">singleStep</a>(). If you want to change this behaviour you can reimplement the virtual function <a href="qabstractspinbox.html#stepBy">stepBy</a>(). The minimum and maximum value and the step size can be set using one of the constructors, and can be changed later with <a href="qspinbox.html#minimum-prop">setMinimum</a>(), <a href="qspinbox.html#maximum-prop">setMaximum</a>() and <a href="qspinbox.html#singleStep-prop">setSingleStep</a>().</p>
<p>Most spin boxes are directional, but QSpinBox can also operate as a circular spin box, i.e. if the range is 0-99 and the current value is 99, clicking "up" will give 0 if <a href="qabstractspinbox.html#wrapping-prop">wrapping</a>() is set to true. Use <a href="qabstractspinbox.html#wrapping-prop">setWrapping</a>() if you want circular behavior.</p>
<p>The displayed value can be prepended and appended with arbitrary strings indicating, for example, currency or the unit of measurement. See <a href="qspinbox.html#prefix-prop">setPrefix</a>() and <a href="qspinbox.html#suffix-prop">setSuffix</a>(). The text in the spin box is retrieved with <a href="qabstractspinbox.html#text-prop">text</a>() (which includes any <a href="qspinbox.html#prefix-prop">prefix</a>() and <a href="qspinbox.html#suffix-prop">suffix</a>()), or with <a href="qspinbox.html#cleanText-prop">cleanText</a>() (which has no <a href="qspinbox.html#prefix-prop">prefix</a>(), no <a href="qspinbox.html#suffix-prop">suffix</a>() and no leading or trailing whitespace).</p>
<p>It is often desirable to give the user a special (often default) choice in addition to the range of numeric values. See <a href="qabstractspinbox.html#specialValueText-prop">setSpecialValueText</a>() for how to do this with QSpinBox.</p>
<table class="generic" width="100%">
<tr valign="top" class="odd"><td ><img src="images/windowsxp-spinbox.png" alt="Screenshot of a Windows XP spin box" /></td><td >A spin box shown in the <a href="gallery-windowsxp.html">Windows XP widget style</a>.</td></tr>
<tr valign="top" class="even"><td ><img src="images/plastique-spinbox.png" alt="Screenshot of a Plastique spin box" /></td><td >A spin box shown in the <a href="gallery-plastique.html">Plastique widget style</a>.</td></tr>
<tr valign="top" class="odd"><td ><img src="images/macintosh-spinbox.png" alt="Screenshot of a Macintosh spin box" /></td><td >A spin box shown in the <a href="gallery-macintosh.html">Macintosh widget style</a>.</td></tr>
</table>
<a name="subclassing-qspinbox"></a>
<h3>Subclassing QSpinBox</h3>
<p>If using <a href="qspinbox.html#prefix-prop">prefix</a>(), <a href="qspinbox.html#suffix-prop">suffix</a>(), and <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>() don't provide enough control, you subclass QSpinBox and reimplement <a href="qspinbox.html#valueFromText">valueFromText</a>() and <a href="qspinbox.html#textFromValue">textFromValue</a>(). For example, here's the code for a custom spin box that allows the user to enter icon sizes (e.g., "32 x 32"):</p>
<pre class="cpp"> <span class="type">int</span> IconSizeSpinBox<span class="operator">::</span><a href="qspinbox.html#valueFromText">valueFromText</a>(<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&</span>text) <span class="keyword">const</span>
{
<span class="type"><a href="qregexp.html">QRegExp</a></span> regExp(tr(<span class="string">"(\\d+)(\\s*[xx]\\s*\\d+)?"</span>));
<span class="keyword">if</span> (regExp<span class="operator">.</span>exactMatch(text)) {
<span class="keyword">return</span> regExp<span class="operator">.</span>cap(<span class="number">1</span>)<span class="operator">.</span>toInt();
} <span class="keyword">else</span> {
<span class="keyword">return</span> <span class="number">0</span>;
}
}
<span class="type"><a href="qstring.html">QString</a></span> IconSizeSpinBox<span class="operator">::</span><a href="qspinbox.html#textFromValue">textFromValue</a>(<span class="type">int</span> value) <span class="keyword">const</span>
{
<span class="keyword">return</span> tr(<span class="string">"%1 x %1"</span>)<span class="operator">.</span>arg(value);
}</pre>
<p>See the <a href="widgets-icons.html">Icons</a> example for the full source code.</p>
</div>
<p><b>See also </b><a href="qdoublespinbox.html">QDoubleSpinBox</a>, <a href="qdatetimeedit.html">QDateTimeEdit</a>, <a href="qslider.html">QSlider</a>, and <a href="widgets-spinboxes.html">Spin Boxes Example</a>.</p>
<!-- @@@QSpinBox -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$cleanText-prop$$$cleanText -->
<h3 class="fn"><a name="cleanText-prop"></a><span class="name">cleanText</span> : const <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the text of the spin box excluding any prefix, suffix, or leading or trailing whitespace.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>cleanText</b></span> () const</td></tr>
</table>
<p><b>See also </b><a href="qabstractspinbox.html#text-prop">text</a>, <a href="qspinbox.html#prefix-prop">QSpinBox::prefix</a>, and <a href="qspinbox.html#suffix-prop">QSpinBox::suffix</a>.</p>
<!-- @@@cleanText -->
<!-- $$$maximum-prop$$$maximum$$$setMaximumint -->
<h3 class="fn"><a name="maximum-prop"></a><span class="name">maximum</span> : <span class="type">int</span></h3>
<p>This property holds the maximum value of the spin box.</p>
<p>When setting this property the <a href="qspinbox.html#minimum-prop">minimum</a> is adjusted if necessary, to ensure that the range remains valid.</p>
<p>The default maximum value is 99.</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>maximum</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setMaximum</b></span> ( int <i>max</i> )</td></tr>
</table>
<p><b>See also </b><a href="qspinbox.html#setRange">setRange</a>() and <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>.</p>
<!-- @@@maximum -->
<!-- $$$minimum-prop$$$minimum$$$setMinimumint -->
<h3 class="fn"><a name="minimum-prop"></a><span class="name">minimum</span> : <span class="type">int</span></h3>
<p>This property holds the minimum value of the spin box.</p>
<p>When setting this property the <a href="qspinbox.html#maximum-prop">maximum</a> is adjusted if necessary to ensure that the range remains valid.</p>
<p>The default minimum value is 0.</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>minimum</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setMinimum</b></span> ( int <i>min</i> )</td></tr>
</table>
<p><b>See also </b><a href="qspinbox.html#setRange">setRange</a>() and <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>.</p>
<!-- @@@minimum -->
<!-- $$$prefix-prop$$$prefix$$$setPrefixconstQString& -->
<h3 class="fn"><a name="prefix-prop"></a><span class="name">prefix</span> : <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the spin box's prefix.</p>
<p>The prefix is prepended to the start of the displayed value. Typical use is to display a unit of measurement or a currency symbol. For example:</p>
<pre class="cpp"> sb<span class="operator">-</span><span class="operator">></span>setPrefix(<span class="string">"$"</span>);</pre>
<p>To turn off the prefix display, set this property to an empty string. The default is no prefix. The prefix is not displayed when <a href="qspinbox.html#value-prop">value</a>() == <a href="qspinbox.html#minimum-prop">minimum</a>() and <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>() is set.</p>
<p>If no prefix is set, prefix() returns an empty string.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>prefix</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setPrefix</b></span> ( const QString & <i>prefix</i> )</td></tr>
</table>
<p><b>See also </b><a href="qspinbox.html#suffix-prop">suffix</a>(), <a href="qspinbox.html#suffix-prop">setSuffix</a>(), <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>(), and <a href="qabstractspinbox.html#specialValueText-prop">setSpecialValueText</a>().</p>
<!-- @@@prefix -->
<!-- $$$singleStep-prop$$$singleStep$$$setSingleStepint -->
<h3 class="fn"><a name="singleStep-prop"></a><span class="name">singleStep</span> : <span class="type">int</span></h3>
<p>This property holds the step value.</p>
<p>When the user uses the arrows to change the spin box's value the value will be incremented/decremented by the amount of the singleStep. The default value is 1. Setting a singleStep value of less than 0 does nothing.</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>singleStep</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSingleStep</b></span> ( int <i>val</i> )</td></tr>
</table>
<!-- @@@singleStep -->
<!-- $$$suffix-prop$$$suffix$$$setSuffixconstQString& -->
<h3 class="fn"><a name="suffix-prop"></a><span class="name">suffix</span> : <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the suffix of the spin box.</p>
<p>The suffix is appended to the end of the displayed value. Typical use is to display a unit of measurement or a currency symbol. For example:</p>
<pre class="cpp"> sb<span class="operator">-</span><span class="operator">></span>setSuffix(<span class="string">" km"</span>);</pre>
<p>To turn off the suffix display, set this property to an empty string. The default is no suffix. The suffix is not displayed for the <a href="qspinbox.html#minimum-prop">minimum</a>() if <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>() is set.</p>
<p>If no suffix is set, suffix() returns an empty string.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>suffix</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSuffix</b></span> ( const QString & <i>suffix</i> )</td></tr>
</table>
<p><b>See also </b><a href="qspinbox.html#prefix-prop">prefix</a>(), <a href="qspinbox.html#prefix-prop">setPrefix</a>(), <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>(), and <a href="qabstractspinbox.html#specialValueText-prop">setSpecialValueText</a>().</p>
<!-- @@@suffix -->
<!-- $$$value-prop$$$value$$$setValueint$$$valueChangedint$$$valueChangedconstQString& -->
<h3 class="fn"><a name="value-prop"></a><span class="name">value</span> : <span class="type">int</span></h3>
<p>This property holds the value of the spin box.</p>
<p>setValue() will emit <a href="qspinbox.html#valueChanged">valueChanged</a>() if the new value is different from the old one.</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>value</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setValue</b></span> ( int <i>val</i> )</td></tr>
</table>
<p><b>Notifier signal:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qspinbox.html#valueChanged">valueChanged</a></b></span> ( int <i>i</i> )</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qspinbox.html#valueChanged-2">valueChanged</a></b></span> ( const QString & <i>text</i> )</td></tr>
</table>
<!-- @@@value -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSpinBox[overload1]$$$QSpinBoxQWidget* -->
<h3 class="fn"><a name="QSpinBox"></a>QSpinBox::<span class="name">QSpinBox</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a spin box with 0 as minimum value and 99 as maximum value, a step value of 1. The value is initially set to 0. It is parented to <i>parent</i>.</p>
<p><b>See also </b><a href="qspinbox.html#minimum-prop">setMinimum</a>(), <a href="qspinbox.html#maximum-prop">setMaximum</a>(), and <a href="qspinbox.html#singleStep-prop">setSingleStep</a>().</p>
<!-- @@@QSpinBox -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QSpinBox::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$fixup[overload1]$$$fixupQString& -->
<h3 class="fn"><a name="fixup"></a><span class="type">void</span> QSpinBox::<span class="name">fixup</span> ( <span class="type"><a href="qstring.html">QString</a></span> & <i>input</i> ) const<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qabstractspinbox.html#fixup">QAbstractSpinBox::fixup</a>().</p>
<!-- @@@fixup -->
<!-- $$$setRange[overload1]$$$setRangeintint -->
<h3 class="fn"><a name="setRange"></a><span class="type">void</span> QSpinBox::<span class="name">setRange</span> ( <span class="type">int</span> <i>minimum</i>, <span class="type">int</span> <i>maximum</i> )</h3>
<p>Convenience function to set the <i>minimum</i>, and <i>maximum</i> values with a single function call.</p>
<pre class="cpp"> setRange(minimum<span class="operator">,</span> maximum);</pre>
<p>is equivalent to:</p>
<pre class="cpp"> <a href="qspinbox.html#minimum-prop">setMinimum</a>(minimum);
<a href="qspinbox.html#maximum-prop">setMaximum</a>(maximum);</pre>
<p><b>See also </b><a href="qspinbox.html#minimum-prop">minimum</a> and <a href="qspinbox.html#maximum-prop">maximum</a>.</p>
<!-- @@@setRange -->
<!-- $$$textFromValue[overload1]$$$textFromValueint -->
<h3 class="fn"><a name="textFromValue"></a><span class="type"><a href="qstring.html">QString</a></span> QSpinBox::<span class="name">textFromValue</span> ( <span class="type">int</span> <i>value</i> ) const<tt> [virtual protected]</tt></h3>
<p>This virtual function is used by the spin box whenever it needs to display the given <i>value</i>. The default implementation returns a string containing <i>value</i> printed in the standard way using <a href="qwidget.html#locale-prop">QWidget::locale</a>().toString(), but with the thousand separator removed. Reimplementations may return anything. (See the example in the detailed description.)</p>
<p>Note: <a href="qspinbox.html">QSpinBox</a> does not call this function for <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>() and that neither <a href="qspinbox.html#prefix-prop">prefix</a>() nor <a href="qspinbox.html#suffix-prop">suffix</a>() should be included in the return value.</p>
<p>If you reimplement this, you may also need to reimplement <a href="qspinbox.html#valueFromText">valueFromText</a>() and <a href="qspinbox.html#validate">validate</a>()</p>
<p><b>See also </b><a href="qspinbox.html#valueFromText">valueFromText</a>(), <a href="qspinbox.html#validate">validate</a>(), and <a href="qlocale.html#groupSeparator">QLocale::groupSeparator</a>().</p>
<!-- @@@textFromValue -->
<!-- $$$validate[overload1]$$$validateQString&int& -->
<h3 class="fn"><a name="validate"></a><span class="type"><a href="qvalidator.html#State-enum">QValidator::State</a></span> QSpinBox::<span class="name">validate</span> ( <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i>, <span class="type">int</span> & <i>pos</i> ) const<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qabstractspinbox.html#validate">QAbstractSpinBox::validate</a>().</p>
<!-- @@@validate -->
<!-- $$$valueChanged[overload1]$$$valueChangedint -->
<h3 class="fn"><a name="valueChanged"></a><span class="type">void</span> QSpinBox::<span class="name">valueChanged</span> ( <span class="type">int</span> <i>i</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted whenever the spin box's value is changed. The new value's integer value is passed in <i>i</i>.</p>
<!-- @@@valueChanged -->
<!-- $$$valueChanged$$$valueChangedconstQString& -->
<h3 class="fn"><a name="valueChanged-2"></a><span class="type">void</span> QSpinBox::<span class="name">valueChanged</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i> )<tt> [signal]</tt></h3>
<p>This is an overloaded function.</p>
<p>The new value is passed literally in <i>text</i> with no <a href="qspinbox.html#prefix-prop">prefix</a>() or <a href="qspinbox.html#suffix-prop">suffix</a>().</p>
<!-- @@@valueChanged -->
<!-- $$$valueFromText[overload1]$$$valueFromTextconstQString& -->
<h3 class="fn"><a name="valueFromText"></a><span class="type">int</span> QSpinBox::<span class="name">valueFromText</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i> ) const<tt> [virtual protected]</tt></h3>
<p>This virtual function is used by the spin box whenever it needs to interpret <i>text</i> entered by the user as a value.</p>
<p>Subclasses that need to display spin box values in a non-numeric way need to reimplement this function.</p>
<p>Note: <a href="qspinbox.html">QSpinBox</a> handles <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>() separately; this function is only concerned with the other values.</p>
<p><b>See also </b><a href="qspinbox.html#textFromValue">textFromValue</a>() and <a href="qspinbox.html#validate">validate</a>().</p>
<!-- @@@valueFromText -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</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>
|