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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QScrollBar Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QScrollBar Class Reference</h1><br clear="all">
<p>
The QScrollBar widget provides a vertical or horizontal scroll bar.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qscrollbar-h.html">qscrollbar.h</a>></code>
<p>
Inherits <a href="qrangecontrol.html">QRangeControl</a> and <a href="qwidget.html">QWidget</a>.
<p><a href="qscrollbar-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#f0fe49"><b>QScrollBar</b></a>(QWidget*parent, constchar*name=0)</div>
<li><div class="fn"><a href="#3f48a2"><b>QScrollBar</b></a>(Orientation, QWidget*parent, constchar*name=0)</div>
<li><div class="fn"><a href="#b3255b"><b>QScrollBar</b></a>(intminValue, intmaxValue, intLineStep, intPageStep, intvalue, Orientation, QWidget*parent, constchar*name=0)</div>
<li><div class="fn">virtualvoid<a href="#e165ba"><b>setOrientation</b></a>(Orientation)</div>
<li><div class="fn">Orientation<a href="#090738"><b>orientation</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#339928"><b>setTracking</b></a>(boolenable)</div>
<li><div class="fn">bool<a href="#d6609d"><b>tracking</b></a>()const</div>
<li><div class="fn">bool<a href="#de158a"><b>draggingSlider</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#57ba52"><b>setPalette</b></a>(constQPalette&)</div>
<li><div class="fn">void<a href="#710b68"><b>setMinValue</b></a>(int)</div>
<li><div class="fn">void<a href="#142226"><b>setMaxValue</b></a>(int)</div>
<li><div class="fn">void<a href="#d061d0"><b>setLineStep</b></a>(int)</div>
<li><div class="fn">void<a href="#fa5bb4"><b>setPageStep</b></a>(int)</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#492c92"><b>valueChanged</b></a>(intvalue)</div>
<li><div class="fn">void<a href="#a92548"><b>sliderPressed</b></a>()</div>
<li><div class="fn">void<a href="#1a6143"><b>sliderMoved</b></a>(intvalue)</div>
<li><div class="fn">void<a href="#a275aa"><b>sliderReleased</b></a>()</div>
<li><div class="fn">void<a href="#cf525d"><b>nextLine</b></a>()</div>
<li><div class="fn">void<a href="#b32bbe"><b>prevLine</b></a>()</div>
<li><div class="fn">void<a href="#ce0200"><b>nextPage</b></a>()</div>
<li><div class="fn">void<a href="#e538f7"><b>prevPage</b></a>()</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">virtualvoid<b>valueChange</b>()(internal)</div>
<li><div class="fn">virtualvoid<b>stepChange</b>()(internal)</div>
<li><div class="fn">virtualvoid<b>rangeChange</b>()(internal)</div>
<li><div class="fn">int<a href="#8ad6e8"><b>sliderStart</b></a>()const</div>
<li><div class="fn">QRect<a href="#a0e154"><b>sliderRect</b></a>()const</div>
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>int<td>minValue<td>minValue<td>setMinValue<td>
<tr><td>int<td>maxValue<td>maxValue<td>setMaxValue<td>
<tr><td>int<td>lineStep<td>lineStep<td>setLineStep<td>
<tr><td>int<td>pageStep<td>pageStep<td>setPageStep<td>
<tr><td>int<td>value<td>value<td>setValue<td>
<tr><td>bool<td>tracking<td>tracking<td>setTracking<td>
<tr><td>bool<td>draggingSlider<td>draggingSlider<td> <td>
<tr><td>Orientation<td>orientation<td>orientation<td>setOrientation<td>
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QScrollBar widget provides a vertical or horizontal scroll bar.
<p>
A scroll bar allows the user to control a value within a
program-definable range, and to give the user visible indication of
the current value of a <a href="qrangecontrol.html">range control</a>.
<p>Scroll bars include four separate controls:
<ul>
<li> The <em>line-up</em> and <em>line-down</em> controls are little button with
which the user can move one line up or down. The meaning of "line"
is configurable. In editors and list boxes it means one line of text,
while an image viewer it might mean 20 pixels.
<li> The <em>slider</em> is the handle that indicates the current value
of the scroll bar, and which the user can drag to change the value.
This part of the scroll bar is sometimes called the "thumb".
<li> The <em>page-up/down</em> control is the area on which the slider
slides (the scroll bar's background). Clicking here moves the scroll
bar towards the click. The meaning of page is also configurable
- in editors and list boxes it means as many lines as there is space
for in the widget.
</ul>
<p>QScrollBar has not much of an API of its own; it mostly relies on
<a href="qrangecontrol.html">QRangeControl</a>. The most useful functions are <a href="#74922e">setValue</a>() to set the
scroll bar directly to some value; <a href="qrangecontrol.html#25562d">addPage</a>(), <a href="qrangecontrol.html#0767c3">addLine</a>(), <a href="qrangecontrol.html#e20fb2">subtractPage</a>()
and <a href="qrangecontrol.html#caed18">subtractLine</a>() to simulate the effects of clicking (useful for
accelerator keys; <a href="qrangecontrol.html#1b6f6d">setSteps</a>() to define the values of <a href="#e3cbb5">pageStep</a>() and
<a href="#96523b">lineStep</a>(); and <a href="qrangecontrol.html#f2409c">setRange</a>() to set the <a href="#9158c7">minValue</a>()
and <a href="#c44794">maxValue</a>() of the scroll bar. QScrollBar has a convenience
constructor with which you can set most of these properties.
<p>Some GUI styles, for example the provided Windows and Motif styles,
also use the pageStep() value to calculate the size of the slider.
<p>In addition to the access functions from QRangeControl, QScrollBar
has a comprehensive set of signals:
<ul>
<li> <a href="#492c92">valueChanged</a>() - emitted when the scroll bar's value has changed.
The <a href="#d6609d">tracking</a>() determines whether this signal is emitted
<em>during</em> interaction.
<li> <a href="#a92548">sliderPressed</a>() - emitted when the user starts to drag the
slider
<li> <a href="#1a6143">sliderMoved</a>() - emitted when the user drags the slider
<li> <a href="#a275aa">sliderReleased</a>() - emitted when the user releases the slider
<li> <a href="#cf525d">nextLine</a>() - emitted when the scroll bar has moved one line
down/rightwards. Line is defined in QRangeControl.
<li> <a href="#b32bbe">prevLine</a>() - emitted when the scroll bar has moved one line
up/leftwards.
<li> <a href="#ce0200">nextPage</a>() - emitted when the scroll bar has moved one page
down/rightwards.
<li> <a href="#e538f7">prevPage</a>() - emitted when the scroll bar has moved one page
up/leftwards.
</ul>
<p>QScrollBar only offers integer ranges. Note that while QScrollBar
handles very large numbers, scroll bars on today's screens cannot
usefully control ranges above about 100,000 pixels. Beyond that,
it becomes difficult for the user to control the
scroll bar using either keyboard or mouse.
<p>A scroll bar can be controlled by the keyboard, but it has a
default <a href="qwidget.html#3d478d">focusPolicy</a>() of <code>NoFocus.</code> Use <a href="qwidget.html#f92b0f">setFocusPolicy</a>() to
enable keyboard focus. See <a href="#d42206">keyPressEvent</a>() for a list of
key bindings.
<p>If you need to add scrollbars to an interface, consider using the
<a href="qscrollview.html">QScrollView</a> class which encapsulates the common uses for scrollbars.
<p><img src=qscrbar-m.png> <img src=qscrbar-w.png>
<p>See also <a href="qslider.html">QSlider</a>, <a href="qspinbox.html">QSpinBox</a>, <a href="qscrollview.html">QScrollView</a> and <a href="guibooks.html#fowler">GUI Design Handbook: Scroll Bar</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="3f48a2"></a>QScrollBar::QScrollBar(<a href="qt.html#Orientation">Orientation</a>orientation, <a href="qwidget.html">QWidget</a>*parent, constchar*name=0)</h3>
<p>Constructs a scroll bar.
<p>The <em>orientation</em> must be QScrollBar::Vertical or QScrollBar::Horizontal.
<p>The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
<h3 class="fn"><a name="f0fe49"></a>QScrollBar::QScrollBar(<a href="qwidget.html">QWidget</a>*parent, constchar*name=0)</h3>
<p>Constructs a vertical scroll bar.
<p>The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
<h3 class="fn"><a name="b3255b"></a>QScrollBar::QScrollBar(intminValue, intmaxValue, intlineStep, intpageStep, intvalue, <a href="qt.html#Orientation">Orientation</a>orientation, <a href="qwidget.html">QWidget</a>*parent, constchar*name=0)</h3>
<p>Constructs a scroll bar.
<p>Arguments:
<ul>
<li><em>minValue</em> is the minimum scroll bar value.
<li><em>maxValue</em> is the maximum scroll bar value.
<li><em>lineStep</em> is the line step value.
<li><em>pageStep</em> is the page step value. It is also used to calculate the size
of the slider.
<li><em>value</em> is the initial value.
<li><em>orientation</em> must be QScrollBar::Vertical or QScrollBar::Horizontal.
</ul>
The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
<h3 class="fn">bool<a name="de158a"></a>QScrollBar::draggingSlider()const</h3>
<p>Returns TRUE if the user has clicked the mouse on the slider
and is currently dragging it, or FALSE if not.
<h3 class="fn">void<a name="d42206"></a>QScrollBar::keyPressEvent(<a href="qkeyevent.html">QKeyEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#0a4482">QWidget.</a>
<h3 class="fn">int<a name="96523b"></a>QScrollBar::lineStep()const</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">int<a name="c44794"></a>QScrollBar::maxValue()const</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">int<a name="9158c7"></a>QScrollBar::minValue()const</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="7b8d5a"></a>QScrollBar::mouseMoveEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#a51d92">QWidget.</a>
<h3 class="fn">void<a name="bde2f8"></a>QScrollBar::mousePressEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#2ecc04">QWidget.</a>
<h3 class="fn">void<a name="c9f0c5"></a>QScrollBar::mouseReleaseEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#9aa77f">QWidget.</a>
<h3 class="fn">void<a name="cf525d"></a>QScrollBar::nextLine() <code>[signal]</code></h3>
<p>This signal is emitted when the scroll bar scrolls one line down/right.
<h3 class="fn">void<a name="ce0200"></a>QScrollBar::nextPage() <code>[signal]</code></h3>
<p>This signal is emitted when the scroll bar scrolls one page down/right.
<h3 class="fn"><a href="qt.html#Orientation">Orientation</a><a name="090738"></a>QScrollBar::orientation()const</h3>
<p>Returns the orientation of the scroll bar; QScrollBar::Vertical or
QScrollBar::Horizontal.
<p>See also <a href="#e165ba">setOrientation</a>().
<h3 class="fn">int<a name="e3cbb5"></a>QScrollBar::pageStep()const</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="772efb"></a>QScrollBar::paintEvent(<a href="qpaintevent.html">QPaintEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#e3d821">QWidget.</a>
<h3 class="fn">void<a name="b32bbe"></a>QScrollBar::prevLine() <code>[signal]</code></h3>
<p>This signal is emitted when the scroll bar scrolls one line up/left.
<h3 class="fn">void<a name="e538f7"></a>QScrollBar::prevPage() <code>[signal]</code></h3>
<p>This signal is emitted when the scroll bar scrolls one page up/left.
<h3 class="fn">void<a name="a12286"></a>QScrollBar::resizeEvent(<a href="qresizeevent.html">QResizeEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#7d375f">QWidget.</a>
<h3 class="fn">void<a name="d061d0"></a>QScrollBar::setLineStep(inti)</h3>
<p>Sets the line step to <em>i.</em>
<p>Calls the virtual <a href="#5b784a">stepChange</a>() function if the new line step is
different from the previous setting.
<p>See also <a href="#96523b">lineStep</a>(), <a href="qrangecontrol.html#1b6f6d">QRangeControl::setSteps</a>(), <a href="#fa5bb4">setPageStep</a>() and <a href="qrangecontrol.html#f2409c">setRange</a>().
<h3 class="fn">void<a name="142226"></a>QScrollBar::setMaxValue(inti)</h3>
<p>A convenience function which just calls
<a href="qrangecontrol.html#f2409c">setRange</a>( <a href="#9158c7">minValue</a>(), i )
<p>See also <a href="qrangecontrol.html#f2409c">setRange</a>().
<h3 class="fn">void<a name="710b68"></a>QScrollBar::setMinValue(inti)</h3>
<p>A convenience function which just calls
<a href="qrangecontrol.html#f2409c">setRange</a>( i, <a href="#c44794">maxValue</a>() )
<p>See also <a href="qrangecontrol.html#f2409c">setRange</a>().
<h3 class="fn">void<a name="e165ba"></a>QScrollBar::setOrientation(<a href="qt.html#Orientation">Orientation</a>orientation) <code>[virtual]</code></h3>
<p>Sets the scroll bar orientation. The <em>orientation</em> must be
QScrollBar::Vertical or QScrollBar::Horizontal.
<p>See also <a href="#090738">orientation</a>().
<h3 class="fn">void<a name="fa5bb4"></a>QScrollBar::setPageStep(inti)</h3>
<p>Sets the page step to <em>i.</em>
<p>Calls the virtual <a href="#5b784a">stepChange</a>() function if the new page step is
different from the previous setting.
<p>See also <a href="#e3cbb5">pageStep</a>(), <a href="qrangecontrol.html#1b6f6d">QRangeControl::setSteps</a>(), <a href="#d061d0">setLineStep</a>() and <a href="qrangecontrol.html#f2409c">setRange</a>().
<h3 class="fn">void<a name="57ba52"></a>QScrollBar::setPalette(const<a href="qpalette.html">QPalette</a>&p) <code>[virtual]</code></h3>
<p>Reimplements the virtual function <a href="qwidget.html#d7e4b9">QWidget::setPalette</a>().
<p>Sets the background color to the mid color for Motif style scroll bars.
<h3 class="fn">void<a name="339928"></a>QScrollBar::setTracking(boolenable) <code>[virtual]</code></h3>
<p>Enables scroll bar tracking if <em>enable</em> is TRUE, or disables tracking
if <em>enable</em> is FALSE.
<p>If tracking is enabled (the default), the scroll bar emits the
<a href="#492c92">valueChanged</a>() signal while the slider is being dragged. If
tracking is disabled, the scroll bar emits the valueChanged() signal
only when the user releases the mouse button after moving the
slider.
<p>See also <a href="#d6609d">tracking</a>().
<h3 class="fn">void<a name="74922e"></a>QScrollBar::setValue(inti)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn"><a href="qsize.html">QSize</a><a name="364175"></a>QScrollBar::sizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4511d1">QWidget.</a>
<h3 class="fn"><a href="qsizepolicy.html">QSizePolicy</a><a name="32b2d6"></a>QScrollBar::sizePolicy()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#23726d">QWidget.</a>
<h3 class="fn">void<a name="1a6143"></a>QScrollBar::sliderMoved(intvalue) <code>[signal]</code></h3>
<p>This signal is emitted when the slider is moved by the user, with
the new scroll bar value as an argument.
<p>This signal is emitted even when tracking is turned off.
<p>See also <a href="#d6609d">tracking</a>(), <a href="#492c92">valueChanged</a>(), <a href="#cf525d">nextLine</a>(), <a href="#b32bbe">prevLine</a>(), <a href="#ce0200">nextPage</a>() and <a href="#e538f7">prevPage</a>().
<h3 class="fn">void<a name="a92548"></a>QScrollBar::sliderPressed() <code>[signal]</code></h3>
<p>This signal is emitted when the user presses the slider with the mouse.
<h3 class="fn"><a href="qrect.html">QRect</a><a name="a0e154"></a>QScrollBar::sliderRect()const <code>[protected]</code></h3>
<p>Returns the scroll bar slider rectangle.
<p>See also <a href="#8ad6e8">sliderStart</a>().
<h3 class="fn">void<a name="a275aa"></a>QScrollBar::sliderReleased() <code>[signal]</code></h3>
<p>This signal is emitted when the user releases the slider with the mouse.
<h3 class="fn">int<a name="8ad6e8"></a>QScrollBar::sliderStart()const <code>[protected]</code></h3>
<p>Returns the pixel position where the scroll bar slider starts.
<p>It is equivalent to <a href="#a0e154">sliderRect</a>().<a href="qwidget.html#800909">y</a>() for vertical
scroll bars or sliderRect().<a href="qwidget.html#6f017a">x</a>() for horizontal scroll bars.
<h3 class="fn">void<a name="8c09a1"></a>QScrollBar::styleChange(<a href="qstyle.html">QStyle</a>&old) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#5e2e23">QWidget.</a>
<h3 class="fn">bool<a name="d6609d"></a>QScrollBar::tracking()const</h3>
<p>Returns TRUE if tracking is enabled, or FALSE if tracking is disabled.
<p>Tracking is initially enabled.
<p>See also <a href="#339928">setTracking</a>().
<h3 class="fn">int<a name="245afe"></a>QScrollBar::value()const</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="492c92"></a>QScrollBar::valueChanged(intvalue) <code>[signal]</code></h3>
<p>This signal is emitted when the scroll bar value has changed, with the
new scroll bar value as an argument.
<h3 class="fn">void<a name="d7fe47"></a>QScrollBar::wheelEvent(<a href="qwheelevent.html">QWheelEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#6f6c80">QWidget.</a>
<h3 class="fn">void<a name="2932d5"></a>QScrollBar::rangeChange() <code>[virtualprotected]</code></h3>
<p>For internal use only.
<p>Reimplemented from <a href="qrangecontrol.html#a849c2">QRangeControl.</a>
<h3 class="fn">void<a name="5b784a"></a>QScrollBar::stepChange() <code>[virtualprotected]</code></h3>
<p>For internal use only.
<p>Reimplemented from <a href="qrangecontrol.html#e0aaf5">QRangeControl.</a>
<h3 class="fn">void<a name="5e0382"></a>QScrollBar::valueChange() <code>[virtualprotected]</code></h3>
<p>For internal use only.
<p>Reimplemented from <a href="qrangecontrol.html#671dc3">QRangeControl.</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|