Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 4806

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?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" />
<!-- qabstractscrollarea.cpp -->
  <title>Qt 4.8: QAbstractScrollArea Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <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>QAbstractScrollArea</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></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="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#protected-slots">Protected Slots</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QAbstractScrollArea Class Reference</h1>
<!-- $$$QAbstractScrollArea-brief -->
<p>The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars. <a href="#details">More...</a></p>
<!-- @@@QAbstractScrollArea -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QAbstractScrollArea&gt;</span></pre><p><b>Inherits: </b><a href="qframe.html">QFrame</a>.</p>
<p><b>Inherited by: </b><a href="qabstractitemview.html">QAbstractItemView</a>, <a href="qgraphicsview.html">QGraphicsView</a>, <a href="qmdiarea.html">QMdiArea</a>, <a href="qplaintextedit.html">QPlainTextEdit</a>, <a href="qscrollarea.html">QScrollArea</a>, and <a href="qtextedit.html">QTextEdit</a>.</p>
<ul>
<li><a href="qabstractscrollarea-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a></b> : Qt::ScrollBarPolicy</li>
<li class="fn"><b><a href="qabstractscrollarea.html#verticalScrollBarPolicy-prop">verticalScrollBarPolicy</a></b> : Qt::ScrollBarPolicy</li>
</ul>
<ul>
<li class="fn">6 properties inherited from <a href="qframe.html#properties">QFrame</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="qabstractscrollarea.html#QAbstractScrollArea">QAbstractScrollArea</a></b> ( QWidget * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#dtor.QAbstractScrollArea">~QAbstractScrollArea</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#addScrollBarWidget">addScrollBarWidget</a></b> ( QWidget * <i>widget</i>, Qt::Alignment <i>alignment</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget * </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#cornerWidget">cornerWidget</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QScrollBar * </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#horizontalScrollBar">horizontalScrollBar</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::ScrollBarPolicy </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#maximumViewportSize">maximumViewportSize</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidgetList </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#scrollBarWidgets">scrollBarWidgets</a></b> ( Qt::Alignment <i>alignment</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#setCornerWidget">setCornerWidget</a></b> ( QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#setHorizontalScrollBar">setHorizontalScrollBar</a></b> ( QScrollBar * <i>scrollBar</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">setHorizontalScrollBarPolicy</a></b> ( Qt::ScrollBarPolicy )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#setVerticalScrollBar">setVerticalScrollBar</a></b> ( QScrollBar * <i>scrollBar</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#verticalScrollBarPolicy-prop">setVerticalScrollBarPolicy</a></b> ( Qt::ScrollBarPolicy )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#setViewport">setViewport</a></b> ( QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QScrollBar * </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#verticalScrollBar">verticalScrollBar</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::ScrollBarPolicy </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#verticalScrollBarPolicy-prop">verticalScrollBarPolicy</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWidget * </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#viewport">viewport</a></b> () const</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#minimumSizeHint">minimumSizeHint</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#sizeHint">sizeHint</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">14 public functions inherited from <a href="qframe.html#public-functions">QFrame</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="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#scrollContentsBy">scrollContentsBy</a></b> ( int <i>dx</i>, int <i>dy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#setViewportMargins">setViewportMargins</a></b> ( int <i>left</i>, int <i>top</i>, int <i>right</i>, int <i>bottom</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#setViewportMargins-2">setViewportMargins</a></b> ( const QMargins &amp; <i>margins</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#viewportEvent">viewportEvent</a></b> ( QEvent * <i>event</i> )</td></tr>
</table>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#contextMenuEvent">contextMenuEvent</a></b> ( QContextMenuEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#dragEnterEvent">dragEnterEvent</a></b> ( QDragEnterEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#dragLeaveEvent">dragLeaveEvent</a></b> ( QDragLeaveEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#dragMoveEvent">dragMoveEvent</a></b> ( QDragMoveEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#dropEvent">dropEvent</a></b> ( QDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.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="qabstractscrollarea.html#keyPressEvent">keyPressEvent</a></b> ( QKeyEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#mouseMoveEvent">mouseMoveEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#mousePressEvent">mousePressEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#mouseReleaseEvent">mouseReleaseEvent</a></b> ( QMouseEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#paintEvent">paintEvent</a></b> ( QPaintEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#resizeEvent">resizeEvent</a></b> ( QResizeEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#wheelEvent">wheelEvent</a></b> ( QWheelEvent * <i>e</i> )</td></tr>
</table>
<ul>
<li class="fn">3 protected functions inherited from <a href="qframe.html#protected-functions">QFrame</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>
<a name="protected-slots"></a>
<h2>Protected Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#setupViewport">setupViewport</a></b> ( QWidget * <i>viewport</i> )</td></tr>
</table>
<ul>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<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>
<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>
<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>
</ul>
<a name="details"></a>
<!-- $$$QAbstractScrollArea-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.</p>
<p>QAbstractScrollArea is a low-level abstraction of a scrolling area. The area provides a central widget called the viewport, in which the contents of the area is to be scrolled (i.e, the visible parts of the contents are rendered in the viewport).</p>
<p>Next to the viewport is a vertical scroll bar, and below is a horizontal scroll bar. When all of the area contents fits in the viewport, each scroll bar can be either visible or hidden depending on the scroll bar's <a href="qt.html#ScrollBarPolicy-enum">Qt::ScrollBarPolicy</a>. When a scroll bar is hidden, the viewport expands in order to cover all available space. When a scroll bar becomes visible again, the viewport shrinks in order to make room for the scroll bar.</p>
<p>It is possible to reserve a margin area around the viewport, see <a href="qabstractscrollarea.html#setViewportMargins">setViewportMargins</a>(). The feature is mostly used to place a <a href="qheaderview.html">QHeaderView</a> widget above or beside the scrolling area. Subclasses of QAbstractScrollArea should implement margins.</p>
<p>When inheriting QAbstractScrollArea, you need to do the following:</p>
<ul>
<li>Control the scroll bars by setting their range, value, page step, and tracking their movements.</li>
<li>Draw the contents of the area in the viewport according to the values of the scroll bars.</li>
<li>Handle events received by the viewport in <a href="qabstractscrollarea.html#viewportEvent">viewportEvent</a>() - notably resize events.</li>
<li>Use <tt>viewport-&gt;update()</tt> to update the contents of the viewport instead of <a href="qwidget.html#update">update()</a> as all painting operations take place on the viewport.</li>
</ul>
<p>With a scroll bar policy of <a href="qt.html#ScrollBarPolicy-enum">Qt::ScrollBarAsNeeded</a> (the default), QAbstractScrollArea shows scroll bars when they provide a non-zero scrolling range, and hides them otherwise.</p>
<p>The scroll bars and viewport should be updated whenever the viewport receives a resize event or the size of the contents changes. The viewport also needs to be updated when the scroll bars values change. The initial values of the scroll bars are often set when the area receives new contents.</p>
<p>We give a simple example, in which we have implemented a scroll area that can scroll any <a href="qwidget.html">QWidget</a>. We make the widget a child of the viewport; this way, we do not have to calculate which part of the widget to draw but can simply move the widget with <a href="qwidget.html#pos-prop">QWidget::move</a>(). When the area contents or the viewport size changes, we do the following:</p>
<pre class="cpp">     <span class="type"><a href="qsize.html">QSize</a></span> areaSize <span class="operator">=</span> viewport()<span class="operator">-</span><span class="operator">&gt;</span>size();
     <span class="type"><a href="qsize.html">QSize</a></span>  widgetSize <span class="operator">=</span> widget<span class="operator">-</span><span class="operator">&gt;</span>size();

     verticalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>setPageStep(areaSize<span class="operator">.</span>height());
     horizontalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>setPageStep(areaSize<span class="operator">.</span>width());
     verticalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>setRange(<span class="number">0</span><span class="operator">,</span> widgetSize<span class="operator">.</span>height() <span class="operator">-</span> areaSize<span class="operator">.</span>height());
     horizontalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>setRange(<span class="number">0</span><span class="operator">,</span> widgetSize<span class="operator">.</span>width() <span class="operator">-</span> areaSize<span class="operator">.</span>width());
     updateWidgetPosition();</pre>
<p>When the scroll bars change value, we need to update the widget position, i.e&#x2e;, find the part of the widget that is to be drawn in the viewport:</p>
<pre class="cpp">     <span class="type">int</span> hvalue <span class="operator">=</span> horizontalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>value();
     <span class="type">int</span> vvalue <span class="operator">=</span> verticalScrollBar()<span class="operator">-</span><span class="operator">&gt;</span>value();
     <span class="type"><a href="qpoint.html">QPoint</a></span> topLeft <span class="operator">=</span> viewport()<span class="operator">-</span><span class="operator">&gt;</span>rect()<span class="operator">.</span>topLeft();

     widget<span class="operator">-</span><span class="operator">&gt;</span>move(topLeft<span class="operator">.</span>x() <span class="operator">-</span> hvalue<span class="operator">,</span> topLeft<span class="operator">.</span>y() <span class="operator">-</span> vvalue);</pre>
<p>In order to track scroll bar movements, reimplement the virtual function <a href="qabstractscrollarea.html#scrollContentsBy">scrollContentsBy</a>(). In order to fine-tune scrolling behavior, connect to a scroll bar's <a href="qabstractslider.html#actionTriggered">QAbstractSlider::actionTriggered</a>() signal and adjust the <a href="qabstractslider.html#sliderPosition-prop">QAbstractSlider::sliderPosition</a> as you wish.</p>
<p>For convenience, QAbstractScrollArea makes all viewport events available in the virtual <a href="qabstractscrollarea.html#viewportEvent">viewportEvent</a>() handler. <a href="qwidget.html">QWidget</a>'s specialized handlers are remapped to viewport events in the cases where this makes sense. The remapped specialized handlers are: <a href="qabstractscrollarea.html#paintEvent">paintEvent</a>(), <a href="qabstractscrollarea.html#mousePressEvent">mousePressEvent</a>(), <a href="qabstractscrollarea.html#mouseReleaseEvent">mouseReleaseEvent</a>(), <a href="qabstractscrollarea.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a>(), <a href="qabstractscrollarea.html#mouseMoveEvent">mouseMoveEvent</a>(), <a href="qabstractscrollarea.html#wheelEvent">wheelEvent</a>(), <a href="qabstractscrollarea.html#dragEnterEvent">dragEnterEvent</a>(), <a href="qabstractscrollarea.html#dragMoveEvent">dragMoveEvent</a>(), <a href="qabstractscrollarea.html#dragLeaveEvent">dragLeaveEvent</a>(), <a href="qabstractscrollarea.html#dropEvent">dropEvent</a>(), <a href="qabstractscrollarea.html#contextMenuEvent">contextMenuEvent</a>(), and <a href="qabstractscrollarea.html#resizeEvent">resizeEvent</a>().</p>
<p><a href="qscrollarea.html">QScrollArea</a>, which inherits QAbstractScrollArea, provides smooth scrolling for any <a href="qwidget.html">QWidget</a> (i.e&#x2e;, the widget is scrolled pixel by pixel). You only need to subclass QAbstractScrollArea if you need more specialized behavior. This is, for instance, true if the entire contents of the area is not suitable for being drawn on a <a href="qwidget.html">QWidget</a> or if you do not want smooth scrolling.</p>
</div>
<p><b>See also </b><a href="qscrollarea.html">QScrollArea</a>.</p>
<!-- @@@QAbstractScrollArea -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$horizontalScrollBarPolicy-prop$$$horizontalScrollBarPolicy$$$setHorizontalScrollBarPolicyQt::ScrollBarPolicy -->
<h3 class="fn"><a name="horizontalScrollBarPolicy-prop"></a><span class="name">horizontalScrollBarPolicy</span> : <span class="type"><a href="qt.html#ScrollBarPolicy-enum">Qt::ScrollBarPolicy</a></span></h3>
<p>This property holds the policy for the horizontal scroll bar.</p>
<p>The default policy is <a href="qt.html#ScrollBarPolicy-enum">Qt::ScrollBarAsNeeded</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::ScrollBarPolicy </td><td class="memItemRight bottomAlign"><span class="name"><b>horizontalScrollBarPolicy</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setHorizontalScrollBarPolicy</b></span> ( Qt::ScrollBarPolicy )</td></tr>
</table>
<p><b>See also </b><a href="qabstractscrollarea.html#verticalScrollBarPolicy-prop">verticalScrollBarPolicy</a>.</p>
<!-- @@@horizontalScrollBarPolicy -->
<!-- $$$verticalScrollBarPolicy-prop$$$verticalScrollBarPolicy$$$setVerticalScrollBarPolicyQt::ScrollBarPolicy -->
<h3 class="fn"><a name="verticalScrollBarPolicy-prop"></a><span class="name">verticalScrollBarPolicy</span> : <span class="type"><a href="qt.html#ScrollBarPolicy-enum">Qt::ScrollBarPolicy</a></span></h3>
<p>This property holds the policy for the vertical scroll bar.</p>
<p>The default policy is <a href="qt.html#ScrollBarPolicy-enum">Qt::ScrollBarAsNeeded</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::ScrollBarPolicy </td><td class="memItemRight bottomAlign"><span class="name"><b>verticalScrollBarPolicy</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setVerticalScrollBarPolicy</b></span> ( Qt::ScrollBarPolicy )</td></tr>
</table>
<p><b>See also </b><a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a>.</p>
<!-- @@@verticalScrollBarPolicy -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QAbstractScrollArea[overload1]$$$QAbstractScrollAreaQWidget* -->
<h3 class="fn"><a name="QAbstractScrollArea"></a>QAbstractScrollArea::<span class="name">QAbstractScrollArea</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a viewport.</p>
<p>The <i>parent</i> argument is sent to the <a href="qwidget.html">QWidget</a> constructor.</p>
<!-- @@@QAbstractScrollArea -->
<!-- $$$~QAbstractScrollArea[overload1]$$$~QAbstractScrollArea -->
<h3 class="fn"><a name="dtor.QAbstractScrollArea"></a>QAbstractScrollArea::<span class="name">~QAbstractScrollArea</span> ()</h3>
<p>Destroys the viewport.</p>
<!-- @@@~QAbstractScrollArea -->
<!-- $$$addScrollBarWidget[overload1]$$$addScrollBarWidgetQWidget*Qt::Alignment -->
<h3 class="fn"><a name="addScrollBarWidget"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">addScrollBarWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i>, <span class="type"><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></span> <i>alignment</i> )</h3>
<p>Adds <i>widget</i> as a scroll bar widget in the location specified by <i>alignment</i>.</p>
<p>Scroll bar widgets are shown next to the horizontal or vertical scroll bar, and can be placed on either side of it. If you want the scroll bar widgets to be always visible, set the scrollBarPolicy for the corresponding scroll bar to <tt>AlwaysOn</tt>.</p>
<p><i>alignment</i> must be one of Qt::Alignleft and <a href="qt.html#AlignmentFlag-enum">Qt::AlignRight</a>, which maps to the horizontal scroll bar, or <a href="qt.html#AlignmentFlag-enum">Qt::AlignTop</a> and <a href="qt.html#AlignmentFlag-enum">Qt::AlignBottom</a>, which maps to the vertical scroll bar.</p>
<p>A scroll bar widget can be removed by either re-parenting the widget or deleting it. It's also possible to hide a widget with <a href="qwidget.html#hide">QWidget::hide</a>()</p>
<p>The scroll bar widget will be resized to fit the scroll bar geometry for the current style. The following describes the case for scroll bar widgets on the horizontal scroll bar:</p>
<p>The height of the widget will be set to match the height of the scroll bar. To control the width of the widget, use QWidget::setMinimumWidth and QWidget::setMaximumWidth, or implement <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>() and set a horizontal size policy. If you want a square widget, call QStyle::pixelMetric(<a href="qstyle.html#PixelMetric-enum">QStyle::PM_ScrollBarExtent</a>) and set the width to this value.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#scrollBarWidgets">scrollBarWidgets</a>().</p>
<!-- @@@addScrollBarWidget -->
<!-- $$$contextMenuEvent[overload1]$$$contextMenuEventQContextMenuEvent* -->
<h3 class="fn"><a name="contextMenuEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">contextMenuEvent</span> ( <span class="type"><a href="qcontextmenuevent.html">QContextMenuEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget::contextMenuEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive context menu events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The event is passed in <i>e</i>.</p>
<p><b>See also </b><a href="qwidget.html#contextMenuEvent">QWidget::contextMenuEvent</a>().</p>
<!-- @@@contextMenuEvent -->
<!-- $$$cornerWidget[overload1]$$$cornerWidget -->
<h3 class="fn"><a name="cornerWidget"></a><span class="type"><a href="qwidget.html">QWidget</a></span> * QAbstractScrollArea::<span class="name">cornerWidget</span> () const</h3>
<p>Returns the widget in the corner between the two scroll bars.</p>
<p>By default, no corner widget is present.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#setCornerWidget">setCornerWidget</a>().</p>
<!-- @@@cornerWidget -->
<!-- $$$dragEnterEvent[overload1]$$$dragEnterEventQDragEnterEvent* -->
<h3 class="fn"><a name="dragEnterEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">dragEnterEvent</span> ( <span class="type"><a href="qdragenterevent.html">QDragEnterEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#dragEnterEvent">QWidget::dragEnterEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive drag enter events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>See also </b><a href="qwidget.html#dragEnterEvent">QWidget::dragEnterEvent</a>().</p>
<!-- @@@dragEnterEvent -->
<!-- $$$dragLeaveEvent[overload1]$$$dragLeaveEventQDragLeaveEvent* -->
<h3 class="fn"><a name="dragLeaveEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">dragLeaveEvent</span> ( <span class="type"><a href="qdragleaveevent.html">QDragLeaveEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#dragLeaveEvent">QWidget::dragLeaveEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive drag leave events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>See also </b><a href="qwidget.html#dragLeaveEvent">QWidget::dragLeaveEvent</a>().</p>
<!-- @@@dragLeaveEvent -->
<!-- $$$dragMoveEvent[overload1]$$$dragMoveEventQDragMoveEvent* -->
<h3 class="fn"><a name="dragMoveEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">dragMoveEvent</span> ( <span class="type"><a href="qdragmoveevent.html">QDragMoveEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#dragMoveEvent">QWidget::dragMoveEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive drag move events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>See also </b><a href="qwidget.html#dragMoveEvent">QWidget::dragMoveEvent</a>().</p>
<!-- @@@dragMoveEvent -->
<!-- $$$dropEvent[overload1]$$$dropEventQDropEvent* -->
<h3 class="fn"><a name="dropEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">dropEvent</span> ( <span class="type"><a href="qdropevent.html">QDropEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#dropEvent">QWidget::dropEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive drop events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>See also </b><a href="qwidget.html#dropEvent">QWidget::dropEvent</a>().</p>
<!-- @@@dropEvent -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QAbstractScrollArea::<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>
<p>This is the main event handler for the <a href="qabstractscrollarea.html">QAbstractScrollArea</a> widget (<i>not</i> the scrolling area <a href="qabstractscrollarea.html#viewport">viewport</a>()). The specified <i>event</i> is a general event object that may need to be cast to the appropriate class depending on its type.</p>
<p><b>See also </b><a href="qevent.html#type">QEvent::type</a>().</p>
<!-- @@@event -->
<!-- $$$horizontalScrollBar[overload1]$$$horizontalScrollBar -->
<h3 class="fn"><a name="horizontalScrollBar"></a><span class="type"><a href="qscrollbar.html">QScrollBar</a></span> * QAbstractScrollArea::<span class="name">horizontalScrollBar</span> () const</h3>
<p>Returns the horizontal scroll bar.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#setHorizontalScrollBar">setHorizontalScrollBar</a>(), <a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a>, and <a href="qabstractscrollarea.html#verticalScrollBar">verticalScrollBar</a>().</p>
<!-- @@@horizontalScrollBar -->
<!-- $$$keyPressEvent[overload1]$$$keyPressEventQKeyEvent* -->
<h3 class="fn"><a name="keyPressEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">keyPressEvent</span> ( <span class="type"><a href="qkeyevent.html">QKeyEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>().</p>
<p>This function is called with key event <i>e</i> when key presses occur. It handles PageUp, PageDown, Up, Down, Left, and Right, and ignores all other key presses.</p>
<!-- @@@keyPressEvent -->
<!-- $$$maximumViewportSize[overload1]$$$maximumViewportSize -->
<h3 class="fn"><a name="maximumViewportSize"></a><span class="type"><a href="qsize.html">QSize</a></span> QAbstractScrollArea::<span class="name">maximumViewportSize</span> () const</h3>
<p>Returns the size of the viewport as if the scroll bars had no valid scrolling range.</p>
<!-- @@@maximumViewportSize -->
<!-- $$$minimumSizeHint[overload1]$$$minimumSizeHint -->
<h3 class="fn"><a name="minimumSizeHint"></a><span class="type"><a href="qsize.html">QSize</a></span> QAbstractScrollArea::<span class="name">minimumSizeHint</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget::minimumSizeHint</a>().</p>
<!-- @@@minimumSizeHint -->
<!-- $$$mouseDoubleClickEvent[overload1]$$$mouseDoubleClickEventQMouseEvent* -->
<h3 class="fn"><a name="mouseDoubleClickEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">mouseDoubleClickEvent</span> ( <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mouseDoubleClickEvent">QWidget::mouseDoubleClickEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive mouse double click events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The event is passed in <i>e</i>.</p>
<p><b>See also </b><a href="qwidget.html#mouseDoubleClickEvent">QWidget::mouseDoubleClickEvent</a>().</p>
<!-- @@@mouseDoubleClickEvent -->
<!-- $$$mouseMoveEvent[overload1]$$$mouseMoveEventQMouseEvent* -->
<h3 class="fn"><a name="mouseMoveEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">mouseMoveEvent</span> ( <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget::mouseMoveEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive mouse move events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The event is passed in <i>e</i>.</p>
<p><b>See also </b><a href="qwidget.html#mouseMoveEvent">QWidget::mouseMoveEvent</a>().</p>
<!-- @@@mouseMoveEvent -->
<!-- $$$mousePressEvent[overload1]$$$mousePressEventQMouseEvent* -->
<h3 class="fn"><a name="mousePressEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">mousePressEvent</span> ( <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive mouse press events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The event is passed in <i>e</i>.</p>
<p><b>See also </b><a href="qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>().</p>
<!-- @@@mousePressEvent -->
<!-- $$$mouseReleaseEvent[overload1]$$$mouseReleaseEventQMouseEvent* -->
<h3 class="fn"><a name="mouseReleaseEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">mouseReleaseEvent</span> ( <span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive mouse release events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The event is passed in <i>e</i>.</p>
<p><b>See also </b><a href="qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>().</p>
<!-- @@@mouseReleaseEvent -->
<!-- $$$paintEvent[overload1]$$$paintEventQPaintEvent* -->
<h3 class="fn"><a name="paintEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">paintEvent</span> ( <span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget::paintEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive paint events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p><b>Note:</b> If you open a painter, make sure to open it on the <a href="qabstractscrollarea.html#viewport">viewport</a>().</p>
<p><b>See also </b><a href="qwidget.html#paintEvent">QWidget::paintEvent</a>().</p>
<!-- @@@paintEvent -->
<!-- $$$resizeEvent[overload1]$$$resizeEventQResizeEvent* -->
<h3 class="fn"><a name="resizeEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">resizeEvent</span> ( <span class="type"><a href="qresizeevent.html">QResizeEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget::resizeEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive resize events (passed in <i>event</i>), for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget.</p>
<p>When resizeEvent() is called, the viewport already has its new geometry: Its new size is accessible through the <a href="qresizeevent.html#size">QResizeEvent::size</a>() function, and the old size through <a href="qresizeevent.html#oldSize">QResizeEvent::oldSize</a>().</p>
<p><b>See also </b><a href="qwidget.html#resizeEvent">QWidget::resizeEvent</a>().</p>
<!-- @@@resizeEvent -->
<!-- $$$scrollBarWidgets[overload1]$$$scrollBarWidgetsQt::Alignment -->
<h3 class="fn"><a name="scrollBarWidgets"></a><span class="type"><a href="qwidget.html#QWidgetList-typedef">QWidgetList</a></span> QAbstractScrollArea::<span class="name">scrollBarWidgets</span> ( <span class="type"><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></span> <i>alignment</i> )</h3>
<p>Returns a list of the currently set scroll bar widgets. <i>alignment</i> can be any combination of the four location flags.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#addScrollBarWidget">addScrollBarWidget</a>().</p>
<!-- @@@scrollBarWidgets -->
<!-- $$$scrollContentsBy[overload1]$$$scrollContentsByintint -->
<h3 class="fn"><a name="scrollContentsBy"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">scrollContentsBy</span> ( <span class="type">int</span> <i>dx</i>, <span class="type">int</span> <i>dy</i> )<tt> [virtual protected]</tt></h3>
<p>This virtual handler is called when the scroll bars are moved by <i>dx</i>, <i>dy</i>, and consequently the viewport's contents should be scrolled accordingly.</p>
<p>The default implementation simply calls <a href="qwidget.html#update">update</a>() on the entire <a href="qabstractscrollarea.html#viewport">viewport</a>(), subclasses can reimplement this handler for optimization purposes, or - like <a href="qscrollarea.html">QScrollArea</a> - to move a contents widget. The parameters <i>dx</i> and <i>dy</i> are there for convenience, so that the class knows how much should be scrolled (useful e.g&#x2e; when doing pixel-shifts). You may just as well ignore these values and scroll directly to the position the scroll bars indicate.</p>
<p>Calling this function in order to scroll programmatically is an error, use the scroll bars instead (e.g&#x2e; by calling <a href="qabstractslider.html#value-prop">QScrollBar::setValue</a>() directly).</p>
<!-- @@@scrollContentsBy -->
<!-- $$$setCornerWidget[overload1]$$$setCornerWidgetQWidget* -->
<h3 class="fn"><a name="setCornerWidget"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setCornerWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<p>Sets the widget in the corner between the two scroll bars to be <i>widget</i>.</p>
<p>You will probably also want to set at least one of the scroll bar modes to <tt>AlwaysOn</tt>.</p>
<p>Passing 0 shows no widget in the corner.</p>
<p>Any previous corner widget is hidden.</p>
<p>You may call setCornerWidget() with the same widget at different times.</p>
<p>All widgets set here will be deleted by the scroll area when it is destroyed unless you separately reparent the widget after setting some other corner widget (or 0).</p>
<p>Any <i>newly</i> set widget should have no current parent.</p>
<p>By default, no corner widget is present.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#cornerWidget">cornerWidget</a>(), <a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a>, and <a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a>.</p>
<!-- @@@setCornerWidget -->
<!-- $$$setHorizontalScrollBar[overload1]$$$setHorizontalScrollBarQScrollBar* -->
<h3 class="fn"><a name="setHorizontalScrollBar"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setHorizontalScrollBar</span> ( <span class="type"><a href="qscrollbar.html">QScrollBar</a></span> * <i>scrollBar</i> )</h3>
<p>Replaces the existing horizontal scroll bar with <i>scrollBar</i>, and sets all the former scroll bar's slider properties on the new scroll bar. The former scroll bar is then deleted.</p>
<p><a href="qabstractscrollarea.html">QAbstractScrollArea</a> already provides horizontal and vertical scroll bars by default. You can call this function to replace the default horizontal scroll bar with your own custom scroll bar.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#horizontalScrollBar">horizontalScrollBar</a>() and <a href="qabstractscrollarea.html#setVerticalScrollBar">setVerticalScrollBar</a>().</p>
<!-- @@@setHorizontalScrollBar -->
<!-- $$$setVerticalScrollBar[overload1]$$$setVerticalScrollBarQScrollBar* -->
<h3 class="fn"><a name="setVerticalScrollBar"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setVerticalScrollBar</span> ( <span class="type"><a href="qscrollbar.html">QScrollBar</a></span> * <i>scrollBar</i> )</h3>
<p>Replaces the existing vertical scroll bar with <i>scrollBar</i>, and sets all the former scroll bar's slider properties on the new scroll bar. The former scroll bar is then deleted.</p>
<p><a href="qabstractscrollarea.html">QAbstractScrollArea</a> already provides vertical and horizontal scroll bars by default. You can call this function to replace the default vertical scroll bar with your own custom scroll bar.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#verticalScrollBar">verticalScrollBar</a>() and <a href="qabstractscrollarea.html#setHorizontalScrollBar">setHorizontalScrollBar</a>().</p>
<!-- @@@setVerticalScrollBar -->
<!-- $$$setViewport[overload1]$$$setViewportQWidget* -->
<h3 class="fn"><a name="setViewport"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setViewport</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<p>Sets the viewport to be the given <i>widget</i>. The <a href="qabstractscrollarea.html">QAbstractScrollArea</a> will take ownership of the given <i>widget</i>.</p>
<p>If <i>widget</i> is 0, <a href="qabstractscrollarea.html">QAbstractScrollArea</a> will assign a new <a href="qwidget.html">QWidget</a> instance for the viewport.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#viewport">viewport</a>().</p>
<!-- @@@setViewport -->
<!-- $$$setViewportMargins[overload1]$$$setViewportMarginsintintintint -->
<h3 class="fn"><a name="setViewportMargins"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setViewportMargins</span> ( <span class="type">int</span> <i>left</i>, <span class="type">int</span> <i>top</i>, <span class="type">int</span> <i>right</i>, <span class="type">int</span> <i>bottom</i> )<tt> [protected]</tt></h3>
<p>Sets the margins around the scrolling area to <i>left</i>, <i>top</i>, <i>right</i> and <i>bottom</i>. This is useful for applications such as spreadsheets with &quot;locked&quot; rows and columns. The marginal space is is left blank; put widgets in the unused area.</p>
<p>Note that this function is frequently called by <a href="qtreeview.html">QTreeView</a> and <a href="qtableview.html">QTableView</a>, so margins must be implemented by <a href="qabstractscrollarea.html">QAbstractScrollArea</a> subclasses. Also, if the subclasses are to be used in item views, they should not call this function.</p>
<p>By default all margins are zero.</p>
<!-- @@@setViewportMargins -->
<!-- $$$setViewportMargins$$$setViewportMarginsconstQMargins& -->
<h3 class="fn"><a name="setViewportMargins-2"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setViewportMargins</span> ( const <span class="type"><a href="qmargins.html">QMargins</a></span> &amp; <i>margins</i> )<tt> [protected]</tt></h3>
<p>Sets <i>margins</i> around the scrolling area. This is useful for applications such as spreadsheets with &quot;locked&quot; rows and columns. The marginal space is is left blank; put widgets in the unused area.</p>
<p>By default all margins are zero.</p>
<p>This function was introduced in Qt 4.6.</p>
<!-- @@@setViewportMargins -->
<!-- $$$setupViewport[overload1]$$$setupViewportQWidget* -->
<h3 class="fn"><a name="setupViewport"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setupViewport</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>viewport</i> )<tt> [protected slot]</tt></h3>
<p>This slot is called by <a href="qabstractscrollarea.html">QAbstractScrollArea</a> after setViewport(<i>viewport</i>) has been called. Reimplement this function in a subclass of <a href="qabstractscrollarea.html">QAbstractScrollArea</a> to initialize the new <i>viewport</i> before it is used.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#setViewport">setViewport</a>().</p>
<!-- @@@setupViewport -->
<!-- $$$sizeHint[overload1]$$$sizeHint -->
<h3 class="fn"><a name="sizeHint"></a><span class="type"><a href="qsize.html">QSize</a></span> QAbstractScrollArea::<span class="name">sizeHint</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>().</p>
<!-- @@@sizeHint -->
<!-- $$$verticalScrollBar[overload1]$$$verticalScrollBar -->
<h3 class="fn"><a name="verticalScrollBar"></a><span class="type"><a href="qscrollbar.html">QScrollBar</a></span> * QAbstractScrollArea::<span class="name">verticalScrollBar</span> () const</h3>
<p>Returns the vertical scroll bar.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#setVerticalScrollBar">setVerticalScrollBar</a>(), <a href="qabstractscrollarea.html#verticalScrollBarPolicy-prop">verticalScrollBarPolicy</a>, and <a href="qabstractscrollarea.html#horizontalScrollBar">horizontalScrollBar</a>().</p>
<!-- @@@verticalScrollBar -->
<!-- $$$viewport[overload1]$$$viewport -->
<h3 class="fn"><a name="viewport"></a><span class="type"><a href="qwidget.html">QWidget</a></span> * QAbstractScrollArea::<span class="name">viewport</span> () const</h3>
<p>Returns the viewport widget.</p>
<p>Use the <a href="qscrollarea.html#widget">QScrollArea::widget</a>() function to retrieve the contents of the viewport widget.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#setViewport">setViewport</a>() and <a href="qscrollarea.html#widget">QScrollArea::widget</a>().</p>
<!-- @@@viewport -->
<!-- $$$viewportEvent[overload1]$$$viewportEventQEvent* -->
<h3 class="fn"><a name="viewportEvent"></a><span class="type">bool</span> QAbstractScrollArea::<span class="name">viewportEvent</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>The main event handler for the scrolling area (the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget). It handles the <i>event</i> specified, and can be called by subclasses to provide reasonable default behavior.</p>
<p>Returns true to indicate to the event system that the event has been handled, and needs no further processing; otherwise returns false to indicate that the event should be propagated further.</p>
<p>You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.</p>
<p>Specialized handlers for viewport events are: <a href="qabstractscrollarea.html#paintEvent">paintEvent</a>(), <a href="qabstractscrollarea.html#mousePressEvent">mousePressEvent</a>(), <a href="qabstractscrollarea.html#mouseReleaseEvent">mouseReleaseEvent</a>(), <a href="qabstractscrollarea.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a>(), <a href="qabstractscrollarea.html#mouseMoveEvent">mouseMoveEvent</a>(), <a href="qabstractscrollarea.html#wheelEvent">wheelEvent</a>(), <a href="qabstractscrollarea.html#dragEnterEvent">dragEnterEvent</a>(), <a href="qabstractscrollarea.html#dragMoveEvent">dragMoveEvent</a>(), <a href="qabstractscrollarea.html#dragLeaveEvent">dragLeaveEvent</a>(), <a href="qabstractscrollarea.html#dropEvent">dropEvent</a>(), <a href="qabstractscrollarea.html#contextMenuEvent">contextMenuEvent</a>(), and <a href="qabstractscrollarea.html#resizeEvent">resizeEvent</a>().</p>
<!-- @@@viewportEvent -->
<!-- $$$wheelEvent[overload1]$$$wheelEventQWheelEvent* -->
<h3 class="fn"><a name="wheelEvent"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">wheelEvent</span> ( <span class="type"><a href="qwheelevent.html">QWheelEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#wheelEvent">QWidget::wheelEvent</a>().</p>
<p>This event handler can be reimplemented in a subclass to receive wheel events for the <a href="qabstractscrollarea.html#viewport">viewport</a>() widget. The event is passed in <i>e</i>.</p>
<p><b>See also </b><a href="qwidget.html#wheelEvent">QWidget::wheelEvent</a>().</p>
<!-- @@@wheelEvent -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      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>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      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>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>