source: trunk/doc/html/qdial.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 21.0 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qdial.cpp:86 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QDial Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDial Class Reference</h1>
33
34<p>The QDial class provides a rounded range control (like a speedometer or potentiometer).
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qdial-h.html">qdial.h</a>&gt;</tt>
37<p>Inherits <a href="qwidget.html">QWidget</a> and <a href="qrangecontrol.html">QRangeControl</a>.
38<p><a href="qdial-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QDial"><b>QDial</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</li>
42<li class=fn><a href="#QDial-2"><b>QDial</b></a> ( int&nbsp;minValue, int&nbsp;maxValue, int&nbsp;pageStep, int&nbsp;value, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
43<li class=fn><a href="#~QDial"><b>~QDial</b></a> ()</li>
44<li class=fn>bool <a href="#tracking"><b>tracking</b></a> () const</li>
45<li class=fn>bool <a href="#wrapping"><b>wrapping</b></a> () const</li>
46<li class=fn>int <a href="#notchSize"><b>notchSize</b></a> () const</li>
47<li class=fn>virtual void <a href="#setNotchTarget"><b>setNotchTarget</b></a> ( double )</li>
48<li class=fn>double <a href="#notchTarget"><b>notchTarget</b></a> () const</li>
49<li class=fn>bool <a href="#notchesVisible"><b>notchesVisible</b></a> () const</li>
50<li class=fn>int <a href="#minValue"><b>minValue</b></a> () const</li>
51<li class=fn>int <a href="#maxValue"><b>maxValue</b></a> () const</li>
52<li class=fn>void <a href="#setMinValue"><b>setMinValue</b></a> ( int )</li>
53<li class=fn>void <a href="#setMaxValue"><b>setMaxValue</b></a> ( int )</li>
54<li class=fn>int <a href="#lineStep"><b>lineStep</b></a> () const</li>
55<li class=fn>int <a href="#pageStep"><b>pageStep</b></a> () const</li>
56<li class=fn>void <a href="#setLineStep"><b>setLineStep</b></a> ( int )</li>
57<li class=fn>void <a href="#setPageStep"><b>setPageStep</b></a> ( int )</li>
58<li class=fn>int <a href="#value"><b>value</b></a> () const</li>
59</ul>
60<h2>Public Slots</h2>
61<ul>
62<li class=fn>virtual void <a href="#setValue"><b>setValue</b></a> ( int )</li>
63<li class=fn>void <a href="#addLine"><b>addLine</b></a> ()</li>
64<li class=fn>void <a href="#subtractLine"><b>subtractLine</b></a> ()</li>
65<li class=fn>void <a href="#addPage"><b>addPage</b></a> ()</li>
66<li class=fn>void <a href="#subtractPage"><b>subtractPage</b></a> ()</li>
67<li class=fn>virtual void <a href="#setNotchesVisible"><b>setNotchesVisible</b></a> ( bool&nbsp;b )</li>
68<li class=fn>virtual void <a href="#setWrapping"><b>setWrapping</b></a> ( bool&nbsp;on )</li>
69<li class=fn>virtual void <a href="#setTracking"><b>setTracking</b></a> ( bool&nbsp;enable )</li>
70</ul>
71<h2>Signals</h2>
72<ul>
73<li class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( int&nbsp;value )</li>
74<li class=fn>void <a href="#dialPressed"><b>dialPressed</b></a> ()</li>
75<li class=fn>void <a href="#dialMoved"><b>dialMoved</b></a> ( int&nbsp;value )</li>
76<li class=fn>void <a href="#dialReleased"><b>dialReleased</b></a> ()</li>
77</ul>
78<h2>Properties</h2>
79<ul>
80<li class=fn>int <a href="#lineStep-prop"><b>lineStep</b></a>&nbsp;- the current line step</li>
81<li class=fn>int <a href="#maxValue-prop"><b>maxValue</b></a>&nbsp;- the current maximum value</li>
82<li class=fn>int <a href="#minValue-prop"><b>minValue</b></a>&nbsp;- the current minimum value</li>
83<li class=fn>int <a href="#notchSize-prop"><b>notchSize</b></a>&nbsp;- the current notch size &nbsp;<em>(read only)</em></li>
84<li class=fn>double <a href="#notchTarget-prop"><b>notchTarget</b></a>&nbsp;- the target number of pixels between notches</li>
85<li class=fn>bool <a href="#notchesVisible-prop"><b>notchesVisible</b></a>&nbsp;- whether the notches are shown</li>
86<li class=fn>int <a href="#pageStep-prop"><b>pageStep</b></a>&nbsp;- the current page step</li>
87<li class=fn>bool <a href="#tracking-prop"><b>tracking</b></a>&nbsp;- whether tracking is enabled</li>
88<li class=fn>int <a href="#value-prop"><b>value</b></a>&nbsp;- the current dial value</li>
89<li class=fn>bool <a href="#wrapping-prop"><b>wrapping</b></a>&nbsp;- whether wrapping is enabled</li>
90</ul>
91<h2>Protected Members</h2>
92<ul>
93<li class=fn>virtual void <a href="#valueChange"><b>valueChange</b></a> ()</li>
94<li class=fn>virtual void <a href="#rangeChange"><b>rangeChange</b></a> ()</li>
95<li class=fn>virtual void <a href="#repaintScreen"><b>repaintScreen</b></a> ( const&nbsp;QRect&nbsp;*&nbsp;cr = 0 )</li>
96</ul>
97<hr><a name="details"></a><h2>Detailed Description</h2>
98
99
100<p> The QDial class provides a rounded range control (like a speedometer or potentiometer).
101<p>
102
103<p> QDial is used when the user needs to control a value within a
104program-definable range, and the range either wraps around
105(typically, 0..359 degrees) or the dialog layout needs a square
106widget.
107<p> Both API- and UI-wise, the dial is very similar to a <a href="qslider.html">slider.</a> Indeed, when <a href="#wrapping">wrapping</a>() is FALSE (the default)
108there is no real difference between a slider and a dial. They
109have the same signals, slots and member functions, all of which do
110the same things. Which one you use depends only on your taste
111and on the application.
112<p> The dial initially emits <a href="#valueChanged">valueChanged</a>() signals continuously while
113the slider is being moved; you can make it emit the signal less
114often by calling <a href="#setTracking">setTracking</a>(FALSE). <a href="#dialMoved">dialMoved</a>() is emitted
115continuously even when <a href="#tracking">tracking</a>() is FALSE.
116<p> The slider also emits <a href="#dialPressed">dialPressed</a>() and <a href="#dialReleased">dialReleased</a>() signals
117when the mouse button is pressed and released. But note that the
118dial's value can change without these signals being emitted; the
119keyboard and wheel can be used to change the value.
120<p> Unlike the slider, QDial attempts to draw a "nice" number of
121notches rather than one per <a href="#lineStep">lineStep</a>(). If possible, the number
122of notches drawn is one per lineStep(), but if there aren't enough
123pixels to draw every one, QDial will draw every second, third
124etc., notch. <a href="#notchSize">notchSize</a>() returns the number of units per notch,
125hopefully a multiple of lineStep(); <a href="#setNotchTarget">setNotchTarget</a>() sets the
126target distance between neighbouring notches in pixels. The
127default is 3.75 pixels.
128<p> Like the slider, the dial makes the <a href="qrangecontrol.html">QRangeControl</a> functions
129<a href="#setValue">setValue</a>(), <a href="#addLine">addLine</a>(), <a href="#subtractLine">subtractLine</a>(), <a href="#addPage">addPage</a>() and
130<a href="#subtractPage">subtractPage</a>() available as slots.
131<p> The dial's keyboard interface is fairly simple: The left/up and
132right/down arrow keys move by lineStep(), page up and page down by
133<a href="#pageStep">pageStep</a>() and Home and End to <a href="#minValue">minValue</a>() and <a href="#maxValue">maxValue</a>().
134<p> <img src=qdial-m.png> <img src=qdial-w.png>
135<p> <p>See also <a href="qscrollbar.html">QScrollBar</a>, <a href="qspinbox.html">QSpinBox</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Slider</a>, and <a href="basic.html">Basic Widgets</a>.
136
137<hr><h2>Member Function Documentation</h2>
138<h3 class=fn><a name="QDial"></a>QDial::QDial ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
139</h3>
140Constructs a dial called <em>name</em> with parent <em>parent</em>. <em>f</em> is
141propagated to the <a href="qwidget.html">QWidget</a> constructor. It has the default range of
142a <a href="qrangecontrol.html">QRangeControl</a>.
143
144<h3 class=fn><a name="QDial-2"></a>QDial::QDial ( int&nbsp;minValue, int&nbsp;maxValue, int&nbsp;pageStep, int&nbsp;value, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
145</h3>
146Constructs a dial called <em>name</em> with parent <em>parent</em>. The dial's
147value can never be smaller than <em>minValue</em> or greater than <em>maxValue</em>. Its page step size is <em>pageStep</em>, and its initial value
148is <em>value</em>.
149<p> <em>value</em> is forced to be within the legal range.
150
151<h3 class=fn><a name="~QDial"></a>QDial::~QDial ()
152</h3>
153Destroys the dial.
154
155<h3 class=fn>void <a name="addLine"></a>QDial::addLine ()<tt> [slot]</tt>
156</h3>
157Increments the dial's <a href="#value">value</a>() by one <a href="#lineStep">lineStep</a>().
158
159<h3 class=fn>void <a name="addPage"></a>QDial::addPage ()<tt> [slot]</tt>
160</h3>
161Increments the dial's <a href="#value">value</a>() by one <a href="#pageStep">pageStep</a>() of steps.
162
163<h3 class=fn>void <a name="dialMoved"></a>QDial::dialMoved ( int&nbsp;value )<tt> [signal]</tt>
164</h3>
165
166<p> This signal is emitted whenever the dial <em>value</em> changes. The
167frequency of this signal is <em>not</em> influenced by <a href="#setTracking">setTracking</a>().
168<p> <p>See also <a href="#valueChanged">valueChanged</a>().
169
170<h3 class=fn>void <a name="dialPressed"></a>QDial::dialPressed ()<tt> [signal]</tt>
171</h3>
172
173<p> This signal is emitted when the user begins mouse interaction with
174the dial.
175<p> <p>See also <a href="#dialReleased">dialReleased</a>().
176
177<h3 class=fn>void <a name="dialReleased"></a>QDial::dialReleased ()<tt> [signal]</tt>
178</h3>
179
180<p> This signal is emitted when the user ends mouse interaction with
181the dial.
182<p> <p>See also <a href="#dialPressed">dialPressed</a>().
183
184<h3 class=fn>int <a name="lineStep"></a>QDial::lineStep () const
185</h3><p>Returns the current line step.
186See the <a href="qdial.html#lineStep-prop">"lineStep"</a> property for details.
187<h3 class=fn>int <a name="maxValue"></a>QDial::maxValue () const
188</h3><p>Returns the current maximum value.
189See the <a href="qdial.html#maxValue-prop">"maxValue"</a> property for details.
190<h3 class=fn>int <a name="minValue"></a>QDial::minValue () const
191</h3><p>Returns the current minimum value.
192See the <a href="qdial.html#minValue-prop">"minValue"</a> property for details.
193<h3 class=fn>int <a name="notchSize"></a>QDial::notchSize () const
194</h3><p>Returns the current notch size.
195See the <a href="qdial.html#notchSize-prop">"notchSize"</a> property for details.
196<h3 class=fn>double <a name="notchTarget"></a>QDial::notchTarget () const
197</h3><p>Returns the target number of pixels between notches.
198See the <a href="qdial.html#notchTarget-prop">"notchTarget"</a> property for details.
199<h3 class=fn>bool <a name="notchesVisible"></a>QDial::notchesVisible () const
200</h3><p>Returns TRUE if the notches are shown; otherwise returns FALSE.
201See the <a href="qdial.html#notchesVisible-prop">"notchesVisible"</a> property for details.
202<h3 class=fn>int <a name="pageStep"></a>QDial::pageStep () const
203</h3><p>Returns the current page step.
204See the <a href="qdial.html#pageStep-prop">"pageStep"</a> property for details.
205<h3 class=fn>void <a name="rangeChange"></a>QDial::rangeChange ()<tt> [virtual protected]</tt>
206</h3>
207Reimplemented to ensure tick-marks are consistent with the new range.
208
209<p>Reimplemented from <a href="qrangecontrol.html#rangeChange">QRangeControl</a>.
210<h3 class=fn>void <a name="repaintScreen"></a>QDial::repaintScreen ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;*&nbsp;cr = 0 )<tt> [virtual protected]</tt>
211</h3>
212Paints the dial using clip region <em>cr</em>.
213
214<h3 class=fn>void <a name="setLineStep"></a>QDial::setLineStep ( int )
215</h3><p>Sets the current line step.
216See the <a href="qdial.html#lineStep-prop">"lineStep"</a> property for details.
217<h3 class=fn>void <a name="setMaxValue"></a>QDial::setMaxValue ( int )
218</h3><p>Sets the current maximum value.
219See the <a href="qdial.html#maxValue-prop">"maxValue"</a> property for details.
220<h3 class=fn>void <a name="setMinValue"></a>QDial::setMinValue ( int )
221</h3><p>Sets the current minimum value.
222See the <a href="qdial.html#minValue-prop">"minValue"</a> property for details.
223<h3 class=fn>void <a name="setNotchTarget"></a>QDial::setNotchTarget ( double )<tt> [virtual]</tt>
224</h3><p>Sets the target number of pixels between notches.
225See the <a href="qdial.html#notchTarget-prop">"notchTarget"</a> property for details.
226<h3 class=fn>void <a name="setNotchesVisible"></a>QDial::setNotchesVisible ( bool&nbsp;b )<tt> [virtual slot]</tt>
227</h3><p>Sets whether the notches are shown to <em>b</em>.
228See the <a href="qdial.html#notchesVisible-prop">"notchesVisible"</a> property for details.
229<h3 class=fn>void <a name="setPageStep"></a>QDial::setPageStep ( int )
230</h3><p>Sets the current page step.
231See the <a href="qdial.html#pageStep-prop">"pageStep"</a> property for details.
232<h3 class=fn>void <a name="setTracking"></a>QDial::setTracking ( bool&nbsp;enable )<tt> [virtual slot]</tt>
233</h3><p>Sets whether tracking is enabled to <em>enable</em>.
234See the <a href="qdial.html#tracking-prop">"tracking"</a> property for details.
235<h3 class=fn>void <a name="setValue"></a>QDial::setValue ( int )<tt> [virtual slot]</tt>
236</h3><p>Sets the current dial value.
237See the <a href="qdial.html#value-prop">"value"</a> property for details.
238<h3 class=fn>void <a name="setWrapping"></a>QDial::setWrapping ( bool&nbsp;on )<tt> [virtual slot]</tt>
239</h3><p>Sets whether wrapping is enabled to <em>on</em>.
240See the <a href="qdial.html#wrapping-prop">"wrapping"</a> property for details.
241<h3 class=fn>void <a name="subtractLine"></a>QDial::subtractLine ()<tt> [slot]</tt>
242</h3>
243Decrements the dial's <a href="#value">value</a>() by one <a href="#lineStep">lineStep</a>().
244
245<h3 class=fn>void <a name="subtractPage"></a>QDial::subtractPage ()<tt> [slot]</tt>
246</h3>
247Decrements the dial's <a href="#value">value</a>() by one <a href="#pageStep">pageStep</a>() of steps.
248
249<h3 class=fn>bool <a name="tracking"></a>QDial::tracking () const
250</h3><p>Returns TRUE if tracking is enabled; otherwise returns FALSE.
251See the <a href="qdial.html#tracking-prop">"tracking"</a> property for details.
252<h3 class=fn>int <a name="value"></a>QDial::value () const
253</h3><p>Returns the current dial value.
254See the <a href="qdial.html#value-prop">"value"</a> property for details.
255<h3 class=fn>void <a name="valueChange"></a>QDial::valueChange ()<tt> [virtual protected]</tt>
256</h3>
257Reimplemented to ensure the display is correct and to emit the
258<a href="#valueChanged">valueChanged</a>(int) signal when appropriate.
259
260<p>Reimplemented from <a href="qrangecontrol.html#valueChange">QRangeControl</a>.
261<h3 class=fn>void <a name="valueChanged"></a>QDial::valueChanged ( int&nbsp;value )<tt> [signal]</tt>
262</h3>
263
264<p> This signal is emitted whenever the dial's <em>value</em> changes. The
265frequency of this signal is influenced by <a href="#setTracking">setTracking</a>().
266
267<h3 class=fn>bool <a name="wrapping"></a>QDial::wrapping () const
268</h3><p>Returns TRUE if wrapping is enabled; otherwise returns FALSE.
269See the <a href="qdial.html#wrapping-prop">"wrapping"</a> property for details.
270<hr><h2>Property Documentation</h2>
271<h3 class=fn>int <a name="lineStep-prop"></a>lineStep</h3>
272<p>This property holds the current line step.
273<p>setLineStep() calls the virtual <a href="qrangecontrol.html#stepChange">stepChange</a>() function if the new
274line step is different from the previous setting.
275<p> <p>See also <a href="qrangecontrol.html#setSteps">QRangeControl::setSteps</a>(), <a href="#pageStep-prop">pageStep</a>, and <a href="qrangecontrol.html#setRange">setRange</a>().
276
277<p>Set this property's value with <a href="#setLineStep">setLineStep</a>() and get this property's value with <a href="#lineStep">lineStep</a>().
278<h3 class=fn>int <a name="maxValue-prop"></a>maxValue</h3>
279<p>This property holds the current maximum value.
280<p>When setting this property, the <a href="#minValue-prop">QDial::minValue</a> is adjusted if
281necessary to ensure that the range remains valid.
282<p> <p>See also <a href="qrangecontrol.html#setRange">setRange</a>().
283
284<p>Set this property's value with <a href="#setMaxValue">setMaxValue</a>() and get this property's value with <a href="#maxValue">maxValue</a>().
285<h3 class=fn>int <a name="minValue-prop"></a>minValue</h3>
286<p>This property holds the current minimum value.
287<p>When setting this property, the <a href="#maxValue-prop">QDial::maxValue</a> is adjusted if
288necessary to ensure that the range remains valid.
289<p> <p>See also <a href="qrangecontrol.html#setRange">setRange</a>().
290
291<p>Set this property's value with <a href="#setMinValue">setMinValue</a>() and get this property's value with <a href="#minValue">minValue</a>().
292<h3 class=fn>int <a name="notchSize-prop"></a>notchSize</h3>
293<p>This property holds the current notch size.
294<p>The notch size is in range control units, not pixels, and if
295possible it is a multiple of <a href="#lineStep">lineStep</a>() that results in an
296on-screen notch size near <a href="#notchTarget">notchTarget</a>().
297<p> <p>See also <a href="#notchTarget-prop">notchTarget</a> and <a href="#lineStep-prop">lineStep</a>.
298
299<p>Get this property's value with <a href="#notchSize">notchSize</a>().
300<h3 class=fn>double <a name="notchTarget-prop"></a>notchTarget</h3>
301<p>This property holds the target number of pixels between notches.
302<p>The notch target is the number of pixels QDial attempts to put
303between each notch.
304<p> The actual size may differ from the target size.
305
306<p>Set this property's value with <a href="#setNotchTarget">setNotchTarget</a>() and get this property's value with <a href="#notchTarget">notchTarget</a>().
307<h3 class=fn>bool <a name="notchesVisible-prop"></a>notchesVisible</h3>
308<p>This property holds whether the notches are shown.
309<p>If TRUE, the notches are shown. If FALSE (the default) notches are
310not shown.
311
312<p>Set this property's value with <a href="#setNotchesVisible">setNotchesVisible</a>() and get this property's value with <a href="#notchesVisible">notchesVisible</a>().
313<h3 class=fn>int <a name="pageStep-prop"></a>pageStep</h3>
314<p>This property holds the current page step.
315<p>setPageStep() calls the virtual <a href="qrangecontrol.html#stepChange">stepChange</a>() function if the new
316page step is different from the previous setting.
317<p> <p>See also <a href="qrangecontrol.html#stepChange">stepChange</a>().
318
319<p>Set this property's value with <a href="#setPageStep">setPageStep</a>() and get this property's value with <a href="#pageStep">pageStep</a>().
320<h3 class=fn>bool <a name="tracking-prop"></a>tracking</h3>
321<p>This property holds whether tracking is enabled.
322<p>If TRUE (the default), tracking is enabled. This means that the
323arrow can be moved using the mouse; otherwise the arrow cannot be
324moved with the mouse.
325
326<p>Set this property's value with <a href="#setTracking">setTracking</a>() and get this property's value with <a href="#tracking">tracking</a>().
327<h3 class=fn>int <a name="value-prop"></a>value</h3>
328<p>This property holds the current dial value.
329<p>This is guaranteed to be within the range
330<a href="#minValue-prop">QDial::minValue</a>..<a href="#maxValue-prop">QDial::maxValue</a>.
331<p> <p>See also <a href="#minValue-prop">minValue</a> and <a href="#maxValue-prop">maxValue</a>.
332
333<p>Set this property's value with <a href="#setValue">setValue</a>() and get this property's value with <a href="#value">value</a>().
334<h3 class=fn>bool <a name="wrapping-prop"></a>wrapping</h3>
335<p>This property holds whether wrapping is enabled.
336<p>If TRUE, wrapping is enabled. This means that the arrow can be
337turned around 360°. Otherwise there is some space at the bottom of
338the dial which is skipped by the arrow.
339<p> This property's default is FALSE.
340
341<p>Set this property's value with <a href="#setWrapping">setWrapping</a>() and get this property's value with <a href="#wrapping">wrapping</a>().
342<!-- eof -->
343<hr><p>
344This file is part of the <a href="index.html">Qt toolkit</a>.
345Copyright &copy; 1995-2007
346<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
347<table width=100% cellspacing=0 border=0><tr>
348<td>Copyright &copy; 2007
349<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
350<td align=right><div align=right>Qt 3.3.8</div>
351</table></div></address></body>
352</html>
Note: See TracBrowser for help on using the repository browser.