Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 4800

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qscrollbar.cpp -->
<head>
  <title>Qt 4.6: QScrollBar Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QScrollBar"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QScrollBar Class Reference<br /><span class="small-subtitle">[<a href="qtgui.html">QtGui</a> module]</span>
</h1>
<p>The QScrollBar widget provides a vertical or horizontal scroll bar. <a href="#details">More...</a></p>
<pre> #include &lt;QScrollBar&gt;</pre><p>Inherits <a href="qabstractslider.html">QAbstractSlider</a>.</p>
<ul>
<li><a href="qscrollbar-members.html">List of all members, including inherited members</a></li>
<li><a href="qscrollbar-qt3.html">Qt 3 support members</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#QScrollBar">QScrollBar</a></b> ( QWidget * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#QScrollBar-2">QScrollBar</a></b> ( Qt::Orientation <i>orientation</i>, QWidget * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#dtor.QScrollBar">~QScrollBar</a></b> ()</td></tr>
</table>
<hr />
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#event">event</a></b> ( QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual QSize </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#sizeHint">sizeHint</a></b> () const</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>22 public functions inherited from <a href="qabstractslider.html#public-functions">QAbstractSlider</a></li>
<li><div bar="2" class="fn"></div>217 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li><div bar="2" class="fn"></div>13 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<hr />
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#initStyleOption">initStyleOption</a></b> ( QStyleOptionSlider * <i>option</i> ) const</td></tr>
</table>
<hr />
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#contextMenuEvent">contextMenuEvent</a></b> ( QContextMenuEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#hideEvent">hideEvent</a></b> ( QHideEvent * )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#mouseMoveEvent">mouseMoveEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#mousePressEvent">mousePressEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#mouseReleaseEvent">mouseReleaseEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#paintEvent">paintEvent</a></b> ( QPaintEvent * )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qscrollbar.html#sliderChange">sliderChange</a></b> ( SliderChange <i>change</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>8 protected functions inherited from <a href="qabstractslider.html#protected-functions">QAbstractSlider</a></li>
<li><div bar="2" class="fn"></div>37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li><div bar="2" class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li><div bar="2" class="fn"></div>1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>11 properties inherited from <a href="qabstractslider.html#properties">QAbstractSlider</a></li>
<li><div class="fn"></div>58 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li><div class="fn"></div>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"></div>2 public slots inherited from <a href="qabstractslider.html#public-slots">QAbstractSlider</a></li>
<li><div class="fn"></div>19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li><div class="fn"></div>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"></div>6 signals inherited from <a href="qabstractslider.html#signals">QAbstractSlider</a></li>
<li><div class="fn"></div>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li><div class="fn"></div>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"></div>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li><div class="fn"></div>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"></div>1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QScrollBar widget provides a vertical or horizontal scroll bar.</p>
<p>A scroll bar is a control that enables the user to access parts of a document that is larger than the widget used to display it. It provides a visual indication of the user's current position within the document and the amount of the document that is visible. Scroll bars are usually equipped with other controls that enable more accurate navigation. Qt displays scroll bars in a way that is appropriate for each platform.</p>
<p>If you need to provide a scrolling view onto another widget, it may be more convenient to use the <a href="qscrollarea.html">QScrollArea</a> class because this provides a viewport widget and scroll bars. QScrollBar is useful if you need to implement similar functionality for specialized widgets using <a href="qabstractscrollarea.html">QAbstractScrollArea</a>; for example, if you decide to subclass <a href="qabstractitemview.html">QAbstractItemView</a>. For most other situations where a slider control is used to obtain a value within a given range, the <a href="qslider.html">QSlider</a> class may be more appropriate for your needs.</p>
<p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td><p align="center"><img src="images/qscrollbar-picture.png" /></p></td><td>Scroll bars typically include four separate controls: a slider, scroll arrows, and a page control.<ul>
<li>a. The slider provides a way to quickly go to any part of the document, but does not support accurate navigation within large documents.</li>
<li>b. The scroll arrows are push buttons which can be used to accurately navigate to a particular place in a document. For a vertical scroll bar connected to a text editor, these typically move the current position one &quot;line&quot; up or down, and adjust the position of the slider by a small amount. In editors and list boxes a &quot;line&quot; might mean one line of text; in an image viewer it might mean 20 pixels.</li>
<li>c. The page control is the area over which the slider is dragged (the scroll bar's background). Clicking here moves the scroll bar towards the click by one &quot;page&quot;. This value is usually the same as the length of the slider.</li>
</ul>
</td></tr>
</table></p>
<p>Each scroll bar has a value that indicates how far the slider is from the start of the scroll bar; this is obtained with <a href="qabstractslider.html#value-prop">value</a>() and set with <a href="qabstractslider.html#value-prop">setValue</a>(). This value always lies within the range of values defined for the scroll bar, from <a href="qabstractslider.html#minimum-prop">minimum()</a> to <a href="qabstractslider.html#minimum-prop">maximum()</a> inclusive. The range of acceptable values can be set with <a href="qabstractslider.html#minimum-prop">setMinimum</a>() and <a href="qabstractslider.html#maximum-prop">setMaximum</a>(). At the minimum value, the top edge of the slider (for a vertical scroll bar) or left edge (for a horizontal scroll bar) will be at the top (or left) end of the scroll bar. At the maximum value, the bottom (or right) edge of the slider will be at the bottom (or right) end of the scroll bar.</p>
<p>The length of the slider is usually related to the value of the page step, and typically represents the proportion of the document area shown in a scrolling view. The page step is the amount that the value changes by when the user presses the <b>Page Up</b> and <b>Page Down</b> keys, and is set with <a href="qabstractslider.html#pageStep-prop">setPageStep</a>(). Smaller changes to the value defined by the line step are made using the cursor keys, and this quantity is set with <a href="qabstractslider.html#singleStep-prop">setSingleStep()</a>.</p>
<p>Note that the range of values used is independent of the actual size of the scroll bar widget. You do not need to take this into account when you choose values for the range and the page step.</p>
<p>The range of values specified for the scroll bar are often determined differently to those for a <a href="qslider.html">QSlider</a> because the length of the slider needs to be taken into account. If we have a document with 100 lines, and we can only show 20 lines in a widget, we may wish to construct a scroll bar with a page step of 20, a minimum value of 0, and a maximum value of 80. This would give us a scroll bar with five &quot;pages&quot;.</p>
<p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td><img src="images/qscrollbar-values.png" /></td><td>The relationship between a document length, the range of values used in a scroll bar, and the page step is simple in many common situations. The scroll bar's range of values is determined by subtracting a chosen page step from some value representing the length of the document. In such cases, the following equation is useful:<p><i>document length</i> = <a href="qabstractslider.html#maximum-prop">maximum</a>() - <a href="qabstractslider.html#minimum-prop">minimum</a>() + <a href="qabstractslider.html#pageStep-prop">pageStep</a>().</p>
</td></tr>
</table></p>
<p>QScrollBar only provides integer ranges. Note that although QScrollBar handles very large numbers, scroll bars on current screens cannot usefully represent ranges above about 100,000 pixels. Beyond that, it becomes difficult for the user to control the slider using either the keyboard or the mouse, and the scroll arrows will have limited use.</p>
<p>ScrollBar inherits a comprehensive set of signals from <a href="qabstractslider.html">QAbstractSlider</a>:</p>
<ul>
<li><a href="qabstractslider.html#valueChanged">valueChanged()</a> is emitted when the scroll bar's value has changed. The tracking() determines whether this signal is emitted during user interaction.</li>
<li><a href="qabstractslider.html#rangeChanged">rangeChanged()</a> is emitted when the scroll bar's range of values has changed.</li>
<li><a href="qabstractslider.html#sliderPressed">sliderPressed()</a> is emitted when the user starts to drag the slider.</li>
<li><a href="qabstractslider.html#sliderMoved">sliderMoved()</a> is emitted when the user drags the slider.</li>
<li><a href="qabstractslider.html#sliderReleased">sliderReleased()</a> is emitted when the user releases the slider.</li>
<li><a href="qabstractslider.html#actionTriggered">actionTriggered()</a> is emitted when the scroll bar is changed by user interaction or via the <a href="qabstractslider.html#triggerAction">triggerAction()</a> function.</li>
</ul>
<p>A scroll bar can be controlled by the keyboard, but it has a default <a href="qwidget.html#focusPolicy-prop">focusPolicy</a>() of <a href="qt.html#FocusPolicy-enum">Qt::NoFocus</a>. Use <a href="qwidget.html#focusPolicy-prop">setFocusPolicy</a>() to enable keyboard interaction with the scroll bar:</p>
<ul>
<li>Left/Right move a horizontal scroll bar by one single step.</li>
<li>Up/Down move a vertical scroll bar by one single step.</li>
<li>PageUp moves up one page.</li>
<li>PageDown moves down one page.</li>
<li>Home moves to the start (mininum).</li>
<li>End moves to the end (maximum).</li>
</ul>
<p>The slider itself can be controlled by using the <a href="qabstractslider.html#triggerAction">triggerAction()</a> function to simulate user interaction with the scroll bar controls. This is useful if you have many different widgets that use a common range of values.</p>
<p>Most GUI styles use the <a href="qabstractslider.html#pageStep-prop">pageStep</a>() value to calculate the size of the slider.</p>
<p><table class="generic" width="100%" align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td><img src="images/macintosh-horizontalscrollbar.png" alt="Screenshot of a Macintosh style scroll bar" /></td><td>A scroll bar shown in the <a href="gallery-macintosh.html">Macintosh widget style</a>.</td></tr>
<tr valign="top" class="even"><td><img src="images/windowsxp-horizontalscrollbar.png" alt="Screenshot of a Windows XP style scroll bar" /></td><td>A scroll bar shown in the <a href="gallery-windowsxp.html">Windows XP widget style</a>.</td></tr>
<tr valign="top" class="odd"><td><img src="images/plastique-horizontalscrollbar.png" alt="Screenshot of a Plastique style scroll bar" /></td><td>A scroll bar shown in the <a href="gallery-plastique.html">Plastique widget style</a>.</td></tr>
</table></p>
<p>See also <a href="qscrollarea.html">QScrollArea</a>, <a href="qslider.html">QSlider</a>, <a href="qdial.html">QDial</a>, <a href="qspinbox.html">QSpinBox</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Scroll Bar</a>, and <a href="widgets-sliders.html">Sliders Example</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QScrollBar/QScrollBar"></a>
<h3 class="fn"><a name="QScrollBar"></a>QScrollBar::QScrollBar ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a vertical scroll bar.</p>
<p>The <i>parent</i> arguments is sent to the <a href="qwidget.html">QWidget</a> constructor.</p>
<p>The <a href="qabstractslider.html#minimum-prop">minimum</a> defaults to 0, the <a href="qabstractslider.html#maximum-prop">maximum</a> to 99, with a <a href="qabstractslider.html#singleStep-prop">singleStep</a> size of 1 and a <a href="qabstractslider.html#pageStep-prop">pageStep</a> size of 10, and an initial <a href="qabstractslider.html#value-prop">value</a> of 0.</p>
<h3 class="fn"><a name="QScrollBar-2"></a>QScrollBar::QScrollBar ( <a href="qt.html#Orientation-enum">Qt::Orientation</a> <i>orientation</i>, <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a scroll bar with the given <i>orientation</i>.</p>
<p>The <i>parent</i> argument is passed to the <a href="qwidget.html">QWidget</a> constructor.</p>
<p>The <a href="qabstractslider.html#minimum-prop">minimum</a> defaults to 0, the <a href="qabstractslider.html#maximum-prop">maximum</a> to 99, with a <a href="qabstractslider.html#singleStep-prop">singleStep</a> size of 1 and a <a href="qabstractslider.html#pageStep-prop">pageStep</a> size of 10, and an initial <a href="qabstractslider.html#value-prop">value</a> of 0.</p>
<a name="//apple_ref/cpp/instm/QScrollBar/~QScrollBar"></a>
<h3 class="fn"><a name="dtor.QScrollBar"></a>QScrollBar::~QScrollBar ()</h3>
<p>Destroys the scroll bar.</p>
<a name="//apple_ref/cpp/instm/QScrollBar/contextMenuEvent"></a>
<h3 class="fn"><a name="contextMenuEvent"></a>void QScrollBar::contextMenuEvent ( <a href="qcontextmenuevent.html">QContextMenuEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget::contextMenuEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/event"></a>
<h3 class="fn"><a name="event"></a>bool QScrollBar::event ( <a href="qevent.html">QEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/hideEvent"></a>
<h3 class="fn"><a name="hideEvent"></a>void QScrollBar::hideEvent ( <a href="qhideevent.html">QHideEvent</a> * )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#hideEvent">QWidget::hideEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/initStyleOption"></a>
<h3 class="fn"><a name="initStyleOption"></a>void QScrollBar::initStyleOption ( <a href="qstyleoptionslider.html">QStyleOptionSlider</a> * <i>option</i> ) const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Initialize <i>option</i> with the values from this <a href="qscrollbar.html">QScrollBar</a>. This method is useful for subclasses when they need a <a href="qstyleoptionslider.html">QStyleOptionSlider</a>, but don't want to fill in all the information themselves.</p>
<p>See also <a href="qstyleoption.html#initFrom">QStyleOption::initFrom</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/mouseMoveEvent"></a>
<h3 class="fn"><a name="mouseMoveEvent"></a>void QScrollBar::mouseMoveEvent ( <a href="qmouseevent.html">QMouseEvent</a> * <i>e</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget::mouseMoveEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/mousePressEvent"></a>
<h3 class="fn"><a name="mousePressEvent"></a>void QScrollBar::mousePressEvent ( <a href="qmouseevent.html">QMouseEvent</a> * <i>e</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/mouseReleaseEvent"></a>
<h3 class="fn"><a name="mouseReleaseEvent"></a>void QScrollBar::mouseReleaseEvent ( <a href="qmouseevent.html">QMouseEvent</a> * <i>e</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/paintEvent"></a>
<h3 class="fn"><a name="paintEvent"></a>void QScrollBar::paintEvent ( <a href="qpaintevent.html">QPaintEvent</a> * )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget::paintEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/sizeHint"></a>
<h3 class="fn"><a name="sizeHint"></a><a href="qsize.html">QSize</a> QScrollBar::sizeHint () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>().</p>
<a name="//apple_ref/cpp/instm/QScrollBar/sliderChange"></a>
<h3 class="fn"><a name="sliderChange"></a>void QScrollBar::sliderChange ( <a href="qabstractslider.html#SliderChange-enum">SliderChange</a> <i>change</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qabstractslider.html#sliderChange">QAbstractSlider::sliderChange</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>