Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 3215

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qabstractscrollarea.cpp -->
  <title>QAbstractScrollArea Class | Qt Widgets 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QAbstractScrollArea</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<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="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QAbstractScrollArea Class</h1>
<!-- $$$QAbstractScrollArea-brief -->
<p>The <a href="qabstractscrollarea.html">QAbstractScrollArea</a> widget provides a scrolling area with on-demand scroll bars. <a href="#details">More...</a></p>
<!-- @@@QAbstractScrollArea -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QAbstractScrollArea&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qframe.html">QFrame</a></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><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>
</td></tr></table></div><ul>
<li><a href="qabstractscrollarea-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#SizeAdjustPolicy-enum">SizeAdjustPolicy</a></b> { AdjustIgnored, AdjustToContents, AdjustToContentsOnFirstShow }</td></tr>
</table></div>
<a name="properties"></a>
<h2 id="properties">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#sizeAdjustPolicy-prop">sizeAdjustPolicy</a></b> : SizeAdjustPolicy</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">59 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><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> = Q_NULLPTR)</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>(<i>Qt::ScrollBarPolicy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#sizeAdjustPolicy-prop">setSizeAdjustPolicy</a></b>(SizeAdjustPolicy <i>policy</i>)</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>(<i>Qt::ScrollBarPolicy</i>)</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"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#setupViewport">setupViewport</a></b>(QWidget *<i>viewport</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> SizeAdjustPolicy </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#sizeAdjustPolicy-prop">sizeAdjustPolicy</a></b>() const</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></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><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></div>
<ul>
<li class="fn">14 public functions inherited from <a href="qframe.html#public-functions">QFrame</a></li>
<li class="fn">214 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">32 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
<li class="fn">14 public functions inherited from <a href="../qtgui/qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><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-1">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>
<tr><td class="memItemLeft rightAlign topAlign"> QMargins </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#viewportMargins">viewportMargins</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qabstractscrollarea.html#viewportSizeHint">viewportSizeHint</a></b>() const</td></tr>
</table></div>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><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></div>
<ul>
<li class="fn">4 protected functions inherited from <a href="qframe.html#protected-functions">QFrame</a></li>
<li class="fn">35 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</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="../qtcore/qobject.html#public-slots">QObject</a></li>
<li class="fn">3 signals inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">5 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
<li class="fn">1 protected type inherited from <a href="../qtgui/qpaintdevice.html#protected-variables">QPaintDevice</a></li>
</ul>
<a name="details"></a>
<!-- $$$QAbstractScrollArea-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qabstractscrollarea.html">QAbstractScrollArea</a> widget provides a scrolling area with on-demand scroll bars.</p>
<p><a href="qabstractscrollarea.html">QAbstractScrollArea</a> 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="../qtcore/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 <a href="qabstractscrollarea.html">QAbstractScrollArea</a> should implement margins.</p>
<p>When inheriting <a href="qabstractscrollarea.html">QAbstractScrollArea</a>, 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 <code>viewport-&gt;update()</code> 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="../qtcore/qt.html#ScrollBarPolicy-enum">Qt::ScrollBarAsNeeded</a> (the default), <a href="qabstractscrollarea.html">QAbstractScrollArea</a> 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="../qtcore/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="../qtcore/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="../qtcore/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, <a href="qabstractscrollarea.html">QAbstractScrollArea</a> 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 <a href="qabstractscrollarea.html">QAbstractScrollArea</a>, 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 <a href="qabstractscrollarea.html">QAbstractScrollArea</a> 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="types">
<h2>Member Type Documentation</h2>
<!-- $$$SizeAdjustPolicy$$$AdjustIgnored$$$AdjustToContentsOnFirstShow$$$AdjustToContents -->
<h3 class="fn" id="SizeAdjustPolicy-enum"><a name="SizeAdjustPolicy-enum"></a>enum QAbstractScrollArea::<span class="name">SizeAdjustPolicy</span></h3>
<p>This enum specifies how the size hint of the <a href="qabstractscrollarea.html">QAbstractScrollArea</a> should adjust when the size of the viewport changes.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAbstractScrollArea::AdjustIgnored</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The scroll area will behave like before - and not do any adjust.</td></tr>
<tr><td class="topAlign"><code>QAbstractScrollArea::AdjustToContents</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The scroll area will always adjust to the viewport</td></tr>
<tr><td class="topAlign"><code>QAbstractScrollArea::AdjustToContentsOnFirstShow</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The scroll area will adjust to its viewport the first time it is shown.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 5.2.</p>
<!-- @@@SizeAdjustPolicy -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$horizontalScrollBarPolicy-prop$$$horizontalScrollBarPolicy$$$setHorizontalScrollBarPolicyQt::ScrollBarPolicy -->
<h3 class="fn" id="horizontalScrollBarPolicy-prop"><a name="horizontalScrollBarPolicy-prop"></a><span class="name">horizontalScrollBarPolicy</span> : <span class="type"><a href="../qtcore/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="../qtcore/qt.html#ScrollBarPolicy-enum">Qt::ScrollBarAsNeeded</a>.</p>
<p><b>Access functions:</b></p>
<div class="table"><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>(<i>Qt::ScrollBarPolicy</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qabstractscrollarea.html#verticalScrollBarPolicy-prop">verticalScrollBarPolicy</a>.</p>
<!-- @@@horizontalScrollBarPolicy -->
<!-- $$$sizeAdjustPolicy-prop$$$sizeAdjustPolicy$$$setSizeAdjustPolicySizeAdjustPolicy -->
<h3 class="fn" id="sizeAdjustPolicy-prop"><a name="sizeAdjustPolicy-prop"></a><span class="name">sizeAdjustPolicy</span> : <span class="type"><a href="qabstractscrollarea.html#SizeAdjustPolicy-enum">SizeAdjustPolicy</a></span></h3>
<p>This property holds the policy describing how the size of the scroll area changes when the size of the viewport changes.</p>
<p>The default policy is <a href="qabstractscrollarea.html#SizeAdjustPolicy-enum">QAbstractScrollArea::AdjustIgnored</a>. Changing this property might actually resize the scrollarea.</p>
<p>This property was introduced in  Qt 5.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> SizeAdjustPolicy </td><td class="memItemRight bottomAlign"><span class="name"><b>sizeAdjustPolicy</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSizeAdjustPolicy</b></span>(SizeAdjustPolicy <i>policy</i>)</td></tr>
</table></div>
<!-- @@@sizeAdjustPolicy -->
<!-- $$$verticalScrollBarPolicy-prop$$$verticalScrollBarPolicy$$$setVerticalScrollBarPolicyQt::ScrollBarPolicy -->
<h3 class="fn" id="verticalScrollBarPolicy-prop"><a name="verticalScrollBarPolicy-prop"></a><span class="name">verticalScrollBarPolicy</span> : <span class="type"><a href="../qtcore/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="../qtcore/qt.html#ScrollBarPolicy-enum">Qt::ScrollBarAsNeeded</a>.</p>
<p><b>Access functions:</b></p>
<div class="table"><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>(<i>Qt::ScrollBarPolicy</i>)</td></tr>
</table></div>
<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" id="QAbstractScrollArea"><a name="QAbstractScrollArea"></a>QAbstractScrollArea::<span class="name">QAbstractScrollArea</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = Q_NULLPTR)</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" id="dtor.QAbstractScrollArea"><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" id="addScrollBarWidget"><a name="addScrollBarWidget"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">addScrollBarWidget</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>widget</i>, <span class="type"><a href="../qtcore/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 <code>AlwaysOn</code>.</p>
<p><i>alignment</i> must be one of Qt::Alignleft and <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignRight</a>, which maps to the horizontal scroll bar, or <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignTop</a> and <a href="../qtcore/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 <a href="qwidget.html#minimumWidth-prop">QWidget::setMinimumWidth</a> and <a href="qwidget.html#maximumWidth-prop">QWidget::setMaximumWidth</a>, or implement <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>() and set a horizontal size policy. If you want a square widget, call <a href="qstyle.html#pixelMetric">QStyle::pixelMetric</a>(<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" id="contextMenuEvent"><a name="contextMenuEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">contextMenuEvent</span>(<span class="type"><a href="../qtgui/qcontextmenuevent.html">QContextMenuEvent</a></span> *<i>e</i>)</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" id="cornerWidget"><a name="cornerWidget"></a><span class="type"><a href="qwidget.html#QWidget">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" id="dragEnterEvent"><a name="dragEnterEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">dragEnterEvent</span>(<span class="type"><a href="../qtgui/qdragenterevent.html">QDragEnterEvent</a></span> *<i>event</i>)</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" id="dragLeaveEvent"><a name="dragLeaveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">dragLeaveEvent</span>(<span class="type"><a href="../qtgui/qdragleaveevent.html">QDragLeaveEvent</a></span> *<i>event</i>)</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" id="dragMoveEvent"><a name="dragMoveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">dragMoveEvent</span>(<span class="type"><a href="../qtgui/qdragmoveevent.html">QDragMoveEvent</a></span> *<i>event</i>)</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" id="dropEvent"><a name="dropEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">dropEvent</span>(<span class="type"><a href="../qtgui/qdropevent.html">QDropEvent</a></span> *<i>event</i>)</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" id="event"><a name="event"></a><code>[virtual protected] </code><span class="type">bool</span> QAbstractScrollArea::<span class="name">event</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="../qtcore/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="../qtcore/qevent.html#type">QEvent::type</a>().</p>
<!-- @@@event -->
<!-- $$$horizontalScrollBar[overload1]$$$horizontalScrollBar -->
<h3 class="fn" id="horizontalScrollBar"><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" id="keyPressEvent"><a name="keyPressEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">keyPressEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>e</i>)</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" id="maximumViewportSize"><a name="maximumViewportSize"></a><span class="type"><a href="../qtcore/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" id="minimumSizeHint"><a name="minimumSizeHint"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QAbstractScrollArea::<span class="name">minimumSizeHint</span>() const</h3>
<p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget::minimumSizeHint</a>().</p>
<!-- @@@minimumSizeHint -->
<!-- $$$mouseDoubleClickEvent[overload1]$$$mouseDoubleClickEventQMouseEvent* -->
<h3 class="fn" id="mouseDoubleClickEvent"><a name="mouseDoubleClickEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">mouseDoubleClickEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</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" id="mouseMoveEvent"><a name="mouseMoveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">mouseMoveEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</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" id="mousePressEvent"><a name="mousePressEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">mousePressEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</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" id="mouseReleaseEvent"><a name="mouseReleaseEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">mouseReleaseEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>e</i>)</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" id="paintEvent"><a name="paintEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">paintEvent</span>(<span class="type"><a href="../qtgui/qpaintevent.html">QPaintEvent</a></span> *<i>event</i>)</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" id="resizeEvent"><a name="resizeEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">resizeEvent</span>(<span class="type"><a href="../qtgui/qresizeevent.html">QResizeEvent</a></span> *<i>event</i>)</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="../qtgui/qresizeevent.html#size">QResizeEvent::size</a>() function, and the old size through <a href="../qtgui/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" id="scrollBarWidgets"><a name="scrollBarWidgets"></a><span class="type">QWidgetList</span> QAbstractScrollArea::<span class="name">scrollBarWidgets</span>(<span class="type"><a href="../qtcore/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" id="scrollContentsBy"><a name="scrollContentsBy"></a><code>[virtual protected] </code><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>)</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" id="setCornerWidget"><a name="setCornerWidget"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setCornerWidget</span>(<span class="type"><a href="qwidget.html#QWidget">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 <code>AlwaysOn</code>.</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" id="setHorizontalScrollBar"><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" id="setVerticalScrollBar"><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" id="setViewport"><a name="setViewport"></a><span class="type">void</span> QAbstractScrollArea::<span class="name">setViewport</span>(<span class="type"><a href="qwidget.html#QWidget">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" id="setViewportMargins"><a name="setViewportMargins"></a><code>[protected] </code><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>)</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>
<p><b>See also </b><a href="qabstractscrollarea.html#viewportMargins">viewportMargins</a>().</p>
<!-- @@@setViewportMargins -->
<!-- $$$setViewportMargins$$$setViewportMarginsconstQMargins& -->
<h3 class="fn" id="setViewportMargins-1"><a name="setViewportMargins-1"></a><code>[protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">setViewportMargins</span>(const <span class="type"><a href="../qtcore/qmargins.html">QMargins</a></span> &amp;<i>margins</i>)</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>
<p><b>See also </b><a href="qabstractscrollarea.html#viewportMargins">viewportMargins</a>().</p>
<!-- @@@setViewportMargins -->
<!-- $$$setupViewport[overload1]$$$setupViewportQWidget* -->
<h3 class="fn" id="setupViewport"><a name="setupViewport"></a><code>[virtual] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">setupViewport</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>viewport</i>)</h3>
<p>This slot is called by <a href="qabstractscrollarea.html">QAbstractScrollArea</a> after <a href="qabstractscrollarea.html#setViewport">setViewport</a>(<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" id="sizeHint"><a name="sizeHint"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QAbstractScrollArea::<span class="name">sizeHint</span>() const</h3>
<p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>().</p>
<p>Returns the sizeHint property of the scroll area. The size is determined by using <a href="qabstractscrollarea.html#viewportSizeHint">viewportSizeHint</a>() plus some extra space for scroll bars, if needed.</p>
<!-- @@@sizeHint -->
<!-- $$$verticalScrollBar[overload1]$$$verticalScrollBar -->
<h3 class="fn" id="verticalScrollBar"><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" id="viewport"><a name="viewport"></a><span class="type"><a href="qwidget.html#QWidget">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" id="viewportEvent"><a name="viewportEvent"></a><code>[virtual protected] </code><span class="type">bool</span> QAbstractScrollArea::<span class="name">viewportEvent</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>event</i>)</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 <code>true</code> to indicate to the event system that the event has been handled, and needs no further processing; otherwise returns <code>false</code> 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 -->
<!-- $$$viewportMargins[overload1]$$$viewportMargins -->
<h3 class="fn" id="viewportMargins"><a name="viewportMargins"></a><code>[protected] </code><span class="type"><a href="../qtcore/qmargins.html">QMargins</a></span> QAbstractScrollArea::<span class="name">viewportMargins</span>() const</h3>
<p>Returns the margins around the scrolling area. By default all the margins are zero.</p>
<p>This function was introduced in  Qt 5.5.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#setViewportMargins">setViewportMargins</a>().</p>
<!-- @@@viewportMargins -->
<!-- $$$viewportSizeHint[overload1]$$$viewportSizeHint -->
<h3 class="fn" id="viewportSizeHint"><a name="viewportSizeHint"></a><code>[virtual protected] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QAbstractScrollArea::<span class="name">viewportSizeHint</span>() const</h3>
<p>Returns the recommended size for the viewport. The default implementation returns <a href="qabstractscrollarea.html#viewport">viewport</a>()-&gt;<a href="qabstractscrollarea.html#sizeHint">sizeHint</a>(). Note that the size is just the viewport's size, without any scroll bars visible.</p>
<p>This function was introduced in  Qt 5.2.</p>
<!-- @@@viewportSizeHint -->
<!-- $$$wheelEvent[overload1]$$$wheelEventQWheelEvent* -->
<h3 class="fn" id="wheelEvent"><a name="wheelEvent"></a><code>[virtual protected] </code><span class="type">void</span> QAbstractScrollArea::<span class="name">wheelEvent</span>(<span class="type"><a href="../qtgui/qwheelevent.html">QWheelEvent</a></span> *<i>e</i>)</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>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    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.<br>    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. </p>
</div>
</body>
</html>