summaryrefslogtreecommitdiffstats
path: root/doc/html/qrangecontrol.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/qrangecontrol.html')
-rw-r--r--doc/html/qrangecontrol.html336
1 files changed, 336 insertions, 0 deletions
diff --git a/doc/html/qrangecontrol.html b/doc/html/qrangecontrol.html
new file mode 100644
index 0000000..8e9df9a
--- /dev/null
+++ b/doc/html/qrangecontrol.html
@@ -0,0 +1,336 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qrangecontrol.cpp:46 -->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>QRangeControl 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&nbsp;Classes</font></a>
+ | <a href="mainclasses.html">
+<font color="#004faf">Main&nbsp;Classes</font></a>
+ | <a href="annotated.html">
+<font color="#004faf">Annotated</font></a>
+ | <a href="groups.html">
+<font color="#004faf">Grouped&nbsp;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>QRangeControl Class Reference</h1>
+
+<p>The QRangeControl class provides an integer value within a range.
+<a href="#details">More...</a>
+<p><tt>#include &lt;<a href="qrangecontrol-h.html">qrangecontrol.h</a>&gt;</tt>
+<p>Inherited by <a href="qdial.html">QDial</a>, <a href="qscrollbar.html">QScrollBar</a>, <a href="qslider.html">QSlider</a>, and <a href="qspinbox.html">QSpinBox</a>.
+<p><a href="qrangecontrol-members.html">List of all member functions.</a>
+<h2>Public Members</h2>
+<ul>
+<li class=fn><a href="#QRangeControl"><b>QRangeControl</b></a> ()</li>
+<li class=fn><a href="#QRangeControl-2"><b>QRangeControl</b></a> ( int&nbsp;minValue, int&nbsp;maxValue, int&nbsp;lineStep, int&nbsp;pageStep, int&nbsp;value )</li>
+<li class=fn>virtual <a href="#~QRangeControl"><b>~QRangeControl</b></a> ()</li>
+<li class=fn>int <a href="#value"><b>value</b></a> () const</li>
+<li class=fn>void <a href="#setValue"><b>setValue</b></a> ( int&nbsp;value )</li>
+<li class=fn>void <a href="#addPage"><b>addPage</b></a> ()</li>
+<li class=fn>void <a href="#subtractPage"><b>subtractPage</b></a> ()</li>
+<li class=fn>void <a href="#addLine"><b>addLine</b></a> ()</li>
+<li class=fn>void <a href="#subtractLine"><b>subtractLine</b></a> ()</li>
+<li class=fn>int <a href="#minValue"><b>minValue</b></a> () const</li>
+<li class=fn>int <a href="#maxValue"><b>maxValue</b></a> () const</li>
+<li class=fn>void <a href="#setRange"><b>setRange</b></a> ( int&nbsp;minValue, int&nbsp;maxValue )</li>
+<li class=fn>void <a href="#setMinValue"><b>setMinValue</b></a> ( int&nbsp;minVal )</li>
+<li class=fn>void <a href="#setMaxValue"><b>setMaxValue</b></a> ( int&nbsp;maxVal )</li>
+<li class=fn>int <a href="#lineStep"><b>lineStep</b></a> () const</li>
+<li class=fn>int <a href="#pageStep"><b>pageStep</b></a> () const</li>
+<li class=fn>void <a href="#setSteps"><b>setSteps</b></a> ( int&nbsp;lineStep, int&nbsp;pageStep )</li>
+<li class=fn>int <a href="#bound"><b>bound</b></a> ( int&nbsp;v ) const</li>
+</ul>
+<h2>Protected Members</h2>
+<ul>
+<li class=fn>int <a href="#positionFromValue"><b>positionFromValue</b></a> ( int&nbsp;logical_val, int&nbsp;span ) const</li>
+<li class=fn>int <a href="#valueFromPosition"><b>valueFromPosition</b></a> ( int&nbsp;pos, int&nbsp;span ) const</li>
+<li class=fn>void <a href="#directSetValue"><b>directSetValue</b></a> ( int&nbsp;value )</li>
+<li class=fn>int <a href="#prevValue"><b>prevValue</b></a> () const</li>
+<li class=fn>virtual void <a href="#valueChange"><b>valueChange</b></a> ()</li>
+<li class=fn>virtual void <a href="#rangeChange"><b>rangeChange</b></a> ()</li>
+<li class=fn>virtual void <a href="#stepChange"><b>stepChange</b></a> ()</li>
+</ul>
+<hr><a name="details"></a><h2>Detailed Description</h2>
+
+
+The QRangeControl class provides an integer value within a range.
+<p>
+<p> Although originally designed for the <a href="qscrollbar.html">QScrollBar</a> widget, the
+QRangeControl can also be used in conjunction with other widgets
+such as <a href="qslider.html">QSlider</a> and <a href="qspinbox.html">QSpinBox</a>. Here are the five main concepts in
+the class:
+<p> <ol type=1>
+<p> <li> <em>Current value</em> The bounded integer that
+QRangeControl maintains. <a href="#value">value</a>() returns it, and several
+functions, including <a href="#setValue">setValue</a>(), set it.
+<p> <li> <em>Minimum</em> The lowest value that value() can ever
+return. Returned by <a href="#minValue">minValue</a>() and set by <a href="#setRange">setRange</a>() or one of the
+constructors.
+<p> <li> <em>Maximum</em> The highest value that value() can ever
+return. Returned by <a href="#maxValue">maxValue</a>() and set by setRange() or one of the
+constructors.
+<p> <li> <em>Line step</em> The smaller of two natural steps that
+QRangeControl provides and typically corresponds to the user
+pressing an arrow key. The line step is returned by <a href="#lineStep">lineStep</a>()
+and set using <a href="#setSteps">setSteps</a>(). The functions <a href="#addLine">addLine</a>() and
+<a href="#subtractLine">subtractLine</a>() respectively increment and decrement the current
+value by lineStep().
+<p> <li> <em>Page step</em> The larger of two natural steps that
+QRangeControl provides and typically corresponds to the user
+pressing PageUp or PageDown. The page step is returned by
+<a href="#pageStep">pageStep</a>() and set using setSteps(). The functions <a href="#addPage">addPage</a>() and
+substractPage() respectively increment and decrement the current
+value by pageStep().
+<p> </ol>
+<p> Unity (1) may be viewed as a third step size. <a href="#setValue">setValue</a>() lets you
+set the current value to any integer in the allowed range, not
+just <a href="#minValue">minValue</a>() + <em>n</em> * lineStep() for integer values of <em>n</em>.
+Some widgets may allow the user to set any value at all; others
+may just provide multiples of lineStep() or pageStep().
+<p> QRangeControl provides three virtual functions that are well
+suited for updating the on-screen representation of range controls
+and emitting signals: <a href="#valueChange">valueChange</a>(), <a href="#rangeChange">rangeChange</a>() and
+<a href="#stepChange">stepChange</a>().
+<p> QRangeControl also provides a function called <a href="#bound">bound</a>() which lets
+you force arbitrary integers to be within the allowed range of the
+range control.
+<p> We recommend that all widgets that inherit QRangeControl provide
+at least a signal called valueChanged(); many widgets will want to
+provide addStep(), <a href="#addPage">addPage</a>(), substractStep() and substractPage()
+as slots.
+<p> Note that you must use multiple inheritance if you plan to
+implement a widget using QRangeControl because QRangeControl is
+not derived from <a href="qwidget.html">QWidget</a>.
+<p>See also <a href="misc.html">Miscellaneous Classes</a>.
+
+<hr><h2>Member Function Documentation</h2>
+<h3 class=fn><a name="QRangeControl"></a>QRangeControl::QRangeControl ()
+</h3>
+Constructs a range control with a minimum value of 0, maximum
+value of 99, line step of 1, page step of 10 and initial value 0.
+
+<h3 class=fn><a name="QRangeControl-2"></a>QRangeControl::QRangeControl ( int&nbsp;minValue, int&nbsp;maxValue, int&nbsp;lineStep, int&nbsp;pageStep, int&nbsp;value )
+</h3>
+Constructs a range control whose value can never be smaller than
+<em>minValue</em> or greater than <em>maxValue</em>, whose line step size is
+<em>lineStep</em> and page step size is <em>pageStep</em> and whose value is
+initially <em>value</em> (which is guaranteed to be in range using
+<a href="#bound">bound</a>()).
+
+<h3 class=fn><a name="~QRangeControl"></a>QRangeControl::~QRangeControl ()<tt> [virtual]</tt>
+</h3>
+Destroys the range control
+
+<h3 class=fn>void <a name="addLine"></a>QRangeControl::addLine ()
+</h3>
+Equivalent to <tt>setValue( value() + lineStep() )</tt>.
+<p> If the value is changed, then <a href="#valueChange">valueChange</a>() is called.
+<p> <p>See also <a href="#subtractLine">subtractLine</a>(), <a href="#addPage">addPage</a>(), and <a href="#setValue">setValue</a>().
+
+<h3 class=fn>void <a name="addPage"></a>QRangeControl::addPage ()
+</h3>
+Equivalent to <tt>setValue( value() + pageStep() )</tt>.
+<p> If the value is changed, then <a href="#valueChange">valueChange</a>() is called.
+<p> <p>See also <a href="#subtractPage">subtractPage</a>(), <a href="#addLine">addLine</a>(), and <a href="#setValue">setValue</a>().
+
+<h3 class=fn>int <a name="bound"></a>QRangeControl::bound ( int&nbsp;v ) const
+</h3>
+Forces the value <em>v</em> to be within the range from <a href="#minValue">minValue</a>() to
+<a href="#maxValue">maxValue</a>() inclusive, and returns the result.
+<p> This function is provided so that you can easily force other
+numbers than <a href="#value">value</a>() into the allowed range. You do not need to
+call it in order to use QRangeControl itself.
+<p> <p>See also <a href="#setValue">setValue</a>(), <a href="#value">value</a>(), <a href="#minValue">minValue</a>(), and <a href="#maxValue">maxValue</a>().
+
+<h3 class=fn>void <a name="directSetValue"></a>QRangeControl::directSetValue ( int&nbsp;value )<tt> [protected]</tt>
+</h3>
+Sets the range control <em>value</em> directly without calling
+<a href="#valueChange">valueChange</a>().
+<p> Forces the new <em>value</em> to be within the legal range.
+<p> You will rarely have to call this function. However, if you want
+to change the range control's value inside the overloaded method
+valueChange(), <a href="#setValue">setValue</a>() would call the function valueChange()
+again. To avoid this recursion you must use <a href="#directSetValue">directSetValue</a>()
+instead.
+<p> <p>See also <a href="#setValue">setValue</a>().
+
+<h3 class=fn>int <a name="lineStep"></a>QRangeControl::lineStep () const
+</h3>
+
+<p> Returns the line step.
+<p> <p>See also <a href="#setSteps">setSteps</a>() and <a href="#pageStep">pageStep</a>().
+
+<h3 class=fn>int <a name="maxValue"></a>QRangeControl::maxValue () const
+</h3>
+
+<p> Returns the maximum value of the range.
+<p> <p>See also <a href="#setMaxValue">setMaxValue</a>(), <a href="#setRange">setRange</a>(), and <a href="#minValue">minValue</a>().
+
+<h3 class=fn>int <a name="minValue"></a>QRangeControl::minValue () const
+</h3>
+
+<p> Returns the minimum value of the range.
+<p> <p>See also <a href="#setMinValue">setMinValue</a>(), <a href="#setRange">setRange</a>(), and <a href="#maxValue">maxValue</a>().
+
+<h3 class=fn>int <a name="pageStep"></a>QRangeControl::pageStep () const
+</h3>
+
+<p> Returns the page step.
+<p> <p>See also <a href="#setSteps">setSteps</a>() and <a href="#lineStep">lineStep</a>().
+
+<h3 class=fn>int <a name="positionFromValue"></a>QRangeControl::positionFromValue ( int&nbsp;logical_val, int&nbsp;span ) const<tt> [protected]</tt>
+</h3>
+Converts <em>logical_val</em> to a pixel position. <a href="#minValue">minValue</a>() maps to 0,
+<a href="#maxValue">maxValue</a>() maps to <em>span</em> and other values are distributed evenly
+in-between.
+<p> This function can handle the entire integer range without
+overflow, providing <em>span</em> is &lt;= 4096.
+<p> Calling this method is useful when actually drawing a range
+control such as a <a href="qscrollbar.html">QScrollBar</a> on-screen.
+<p> <p>See also <a href="#valueFromPosition">valueFromPosition</a>().
+
+<h3 class=fn>int <a name="prevValue"></a>QRangeControl::prevValue () const<tt> [protected]</tt>
+</h3>
+
+<p> Returns the previous value of the range control. "Previous value"
+means the value before the last change occurred. Setting a new
+range may affect the value, too, because the value is forced to be
+inside the specified range. When the range control is initially
+created, this is the same as <a href="#value">value</a>().
+<p> <a href="#prevValue">prevValue</a>() can be outside the current legal range if a call to
+<a href="#setRange">setRange</a>() causes the current value to change. For example, if the
+range was [0, 1000] and the current value is 500, setRange(0, 400)
+makes value() return 400 and prevValue() return 500.
+<p> <p>See also <a href="#value">value</a>() and <a href="#setRange">setRange</a>().
+
+<h3 class=fn>void <a name="rangeChange"></a>QRangeControl::rangeChange ()<tt> [virtual protected]</tt>
+</h3>
+This virtual function is called whenever the range control's range
+changes. You can reimplement it if you want to be notified when
+the range changes. The default implementation does nothing.
+<p> Note that this method is called after the range has changed.
+<p> <p>See also <a href="#setRange">setRange</a>(), <a href="#valueChange">valueChange</a>(), and <a href="#stepChange">stepChange</a>().
+
+<p>Reimplemented in <a href="qdial.html#rangeChange">QDial</a>, <a href="qslider.html#rangeChange">QSlider</a>, and <a href="qspinbox.html#rangeChange">QSpinBox</a>.
+<h3 class=fn>void <a name="setMaxValue"></a>QRangeControl::setMaxValue ( int&nbsp;maxVal )
+</h3>
+Sets the minimum value of the range to <em>maxVal</em>.
+<p> If necessary, the <a href="#minValue">minValue</a>() is adjusted so that the range remains
+valid.
+<p> <p>See also <a href="#maxValue">maxValue</a>() and <a href="#setMinValue">setMinValue</a>().
+
+<h3 class=fn>void <a name="setMinValue"></a>QRangeControl::setMinValue ( int&nbsp;minVal )
+</h3>
+Sets the minimum value of the range to <em>minVal</em>.
+<p> If necessary, the <a href="#maxValue">maxValue</a>() is adjusted so that the range remains
+valid.
+<p> <p>See also <a href="#minValue">minValue</a>() and <a href="#setMaxValue">setMaxValue</a>().
+
+<h3 class=fn>void <a name="setRange"></a>QRangeControl::setRange ( int&nbsp;minValue, int&nbsp;maxValue )
+</h3>
+Sets the range control's minimum value to <em>minValue</em> and its
+maximum value to <em>maxValue</em>.
+<p> Calls the virtual <a href="#rangeChange">rangeChange</a>() function if one or both of the new
+minimum and maximum values are different from the previous
+setting. Calls the virtual <a href="#valueChange">valueChange</a>() function if the current
+value is adjusted because it was outside the new range.
+<p> If <em>maxValue</em> is smaller than <em>minValue</em>, <em>minValue</em> becomes
+the only legal value.
+<p> <p>See also <a href="#minValue">minValue</a>() and <a href="#maxValue">maxValue</a>().
+
+<p>Examples: <a href="listbox-example.html#x1441">listbox/listbox.cpp</a>, <a href="tutorial1-12.html#x2387">t12/lcdrange.cpp</a>, <a href="tutorial1-05.html#x2315">t5/main.cpp</a>, <a href="tutorial1-06.html#x2325">t6/main.cpp</a>, <a href="tutorial1-08.html#x2334">t8/lcdrange.cpp</a>, and <a href="xform-example.html#x1250">xform/xform.cpp</a>.
+<h3 class=fn>void <a name="setSteps"></a>QRangeControl::setSteps ( int&nbsp;lineStep, int&nbsp;pageStep )
+</h3>
+Sets the range's line step to <em>lineStep</em> and page step to <em>pageStep</em>.
+<p> Calls the virtual <a href="#stepChange">stepChange</a>() function if the new line step
+or page step are different from the previous settings.
+<p> <p>See also <a href="#lineStep">lineStep</a>(), <a href="#pageStep">pageStep</a>(), and <a href="#setRange">setRange</a>().
+
+<h3 class=fn>void <a name="setValue"></a>QRangeControl::setValue ( int&nbsp;value )
+</h3>
+Sets the range control's value to <em>value</em> and forces it to be
+within the legal range.
+<p> Calls the virtual <a href="#valueChange">valueChange</a>() function if the new value is
+different from the previous value. The old value can still be
+retrieved using <a href="#prevValue">prevValue</a>().
+<p> <p>See also <a href="#value">value</a>().
+
+<h3 class=fn>void <a name="stepChange"></a>QRangeControl::stepChange ()<tt> [virtual protected]</tt>
+</h3>
+This virtual function is called whenever the range control's
+line or page step settings change. You can reimplement it if you
+want to be notified when the step changes. The default
+implementation does nothing.
+<p> Note that this method is called after a step setting has changed.
+<p> <p>See also <a href="#setSteps">setSteps</a>(), <a href="#rangeChange">rangeChange</a>(), and <a href="#valueChange">valueChange</a>().
+
+<h3 class=fn>void <a name="subtractLine"></a>QRangeControl::subtractLine ()
+</h3>
+Equivalent to <tt>setValue( value() - lineStep() )</tt>.
+<p> If the value is changed, then <a href="#valueChange">valueChange</a>() is called.
+<p> <p>See also <a href="#addLine">addLine</a>(), <a href="#subtractPage">subtractPage</a>(), and <a href="#setValue">setValue</a>().
+
+<h3 class=fn>void <a name="subtractPage"></a>QRangeControl::subtractPage ()
+</h3>
+Equivalent to <tt>setValue( value() - pageStep() )</tt>.
+<p> If the value is changed, then <a href="#valueChange">valueChange</a>() is called.
+<p> <p>See also <a href="#addPage">addPage</a>(), <a href="#subtractLine">subtractLine</a>(), and <a href="#setValue">setValue</a>().
+
+<h3 class=fn>int <a name="value"></a>QRangeControl::value () const
+</h3>
+
+<p> Returns the current range control value. This is guaranteed to be
+within the range [minValue(), <a href="#maxValue">maxValue</a>()].
+<p> <p>See also <a href="#setValue">setValue</a>() and <a href="#prevValue">prevValue</a>().
+
+<h3 class=fn>void <a name="valueChange"></a>QRangeControl::valueChange ()<tt> [virtual protected]</tt>
+</h3>
+This virtual function is called whenever the range control value
+changes. You can reimplement it if you want to be notified when
+the value changes. The default implementation does nothing.
+<p> Note that this method is called after the value has changed. The
+previous value can be retrieved using <a href="#prevValue">prevValue</a>().
+<p> <p>See also <a href="#setValue">setValue</a>(), <a href="#addPage">addPage</a>(), <a href="#subtractPage">subtractPage</a>(), <a href="#addLine">addLine</a>(), <a href="#subtractLine">subtractLine</a>(), <a href="#rangeChange">rangeChange</a>(), and <a href="#stepChange">stepChange</a>().
+
+<p>Reimplemented in <a href="qdial.html#valueChange">QDial</a>, <a href="qslider.html#valueChange">QSlider</a>, and <a href="qspinbox.html#valueChange">QSpinBox</a>.
+<h3 class=fn>int <a name="valueFromPosition"></a>QRangeControl::valueFromPosition ( int&nbsp;pos, int&nbsp;span ) const<tt> [protected]</tt>
+</h3>
+Converts the pixel position <em>pos</em> to a value. 0 maps to
+<a href="#minValue">minValue</a>(), <em>span</em> maps to <a href="#maxValue">maxValue</a>() and other values are
+distributed evenly in-between.
+<p> This function can handle the entire integer range without
+overflow.
+<p> Calling this method is useful if you actually implemented a range
+control widget such as <a href="qscrollbar.html">QScrollBar</a> and want to handle mouse press
+events. This function then maps screen coordinates to the logical
+values.
+<p> <p>See also <a href="#positionFromValue">positionFromValue</a>().
+
+<!-- eof -->
+<hr><p>
+This file is part of the <a href="index.html">Qt toolkit</a>.
+Copyright &copy; 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 &copy; 2007
+<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
+<td align=right><div align=right>Qt 3.3.8</div>
+</table></div></address></body>
+</html>