Sophie

Sophie

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

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" />
<!-- qgraphicsview.cpp -->
  <title>QGraphicsView 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 >QGraphicsView</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="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</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="#protected-slots">Protected Slots</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">QGraphicsView Class</h1>
<!-- $$$QGraphicsView-brief -->
<p>The <a href="qgraphicsview.html">QGraphicsView</a> class provides a widget for displaying the contents of a <a href="qgraphicsscene.html">QGraphicsScene</a>. <a href="#details">More...</a></p>
<!-- @@@QGraphicsView -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QGraphicsView&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"> Since:</td><td class="memItemRight bottomAlign">  Qt 4.2</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qabstractscrollarea.html">QAbstractScrollArea</a></td></tr></table></div><ul>
<li><a href="qgraphicsview-members.html">List of all members, including inherited members</a></li>
<li><a href="qgraphicsview-obsolete.html">Obsolete 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"> flags </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#CacheModeFlag-enum">CacheMode</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#CacheModeFlag-enum">CacheModeFlag</a></b> { CacheNone, CacheBackground }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#DragMode-enum">DragMode</a></b> { NoDrag, ScrollHandDrag, RubberBandDrag }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#OptimizationFlag-enum">OptimizationFlag</a></b> { DontClipPainter, DontSavePainterState, DontAdjustForAntialiasing, IndirectPainting }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#OptimizationFlag-enum">OptimizationFlags</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#ViewportAnchor-enum">ViewportAnchor</a></b> { NoAnchor, AnchorViewCenter, AnchorUnderMouse }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#ViewportUpdateMode-enum">ViewportUpdateMode</a></b> { FullViewportUpdate, MinimalViewportUpdate, SmartViewportUpdate, BoundingRectViewportUpdate, NoViewportUpdate }</td></tr>
</table></div>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<div class="table"><table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qgraphicsview.html#alignment-prop">alignment</a></b> : Qt::Alignment</li>
<li class="fn"><b><a href="qgraphicsview.html#backgroundBrush-prop">backgroundBrush</a></b> : QBrush</li>
<li class="fn"><b><a href="qgraphicsview.html#cacheMode-prop">cacheMode</a></b> : CacheMode</li>
<li class="fn"><b><a href="qgraphicsview.html#dragMode-prop">dragMode</a></b> : DragMode</li>
<li class="fn"><b><a href="qgraphicsview.html#foregroundBrush-prop">foregroundBrush</a></b> : QBrush</li>
<li class="fn"><b><a href="qgraphicsview.html#interactive-prop">interactive</a></b> : bool</li>
<li class="fn"><b><a href="qgraphicsview.html#optimizationFlags-prop">optimizationFlags</a></b> : OptimizationFlags</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qgraphicsview.html#renderHints-prop">renderHints</a></b> : QPainter::RenderHints</li>
<li class="fn"><b><a href="qgraphicsview.html#resizeAnchor-prop">resizeAnchor</a></b> : ViewportAnchor</li>
<li class="fn"><b><a href="qgraphicsview.html#rubberBandSelectionMode-prop">rubberBandSelectionMode</a></b> : Qt::ItemSelectionMode</li>
<li class="fn"><b><a href="qgraphicsview.html#sceneRect-prop">sceneRect</a></b> : QRectF</li>
<li class="fn"><b><a href="qgraphicsview.html#transformationAnchor-prop">transformationAnchor</a></b> : ViewportAnchor</li>
<li class="fn"><b><a href="qgraphicsview.html#viewportUpdateMode-prop">viewportUpdateMode</a></b> : ViewportUpdateMode</li>
</ul>
</td></tr>
</table></div>
<ul>
<li class="fn">3 properties inherited from <a href="qabstractscrollarea.html#properties">QAbstractScrollArea</a></li>
<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="qgraphicsview.html#QGraphicsView">QGraphicsView</a></b>(QWidget *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#QGraphicsView-1">QGraphicsView</a></b>(QGraphicsScene *<i>scene</i>, QWidget *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#dtor.QGraphicsView">~QGraphicsView</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#alignment-prop">alignment</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#backgroundBrush-prop">backgroundBrush</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> CacheMode </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#cacheMode-prop">cacheMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#centerOn">centerOn</a></b>(const QPointF &amp;<i>pos</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#centerOn-1">centerOn</a></b>(qreal <i>x</i>, qreal <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#centerOn-2">centerOn</a></b>(const QGraphicsItem *<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> DragMode </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#dragMode-prop">dragMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#ensureVisible">ensureVisible</a></b>(const QRectF &amp;<i>rect</i>, int <i>xmargin</i> = 50, int <i>ymargin</i> = 50)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#ensureVisible-1">ensureVisible</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>, int <i>xmargin</i> = 50, int <i>ymargin</i> = 50)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#ensureVisible-2">ensureVisible</a></b>(const QGraphicsItem *<i>item</i>, int <i>xmargin</i> = 50, int <i>ymargin</i> = 50)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#fitInView">fitInView</a></b>(const QRectF &amp;<i>rect</i>, Qt::AspectRatioMode <i>aspectRatioMode</i> = Qt::IgnoreAspectRatio)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#fitInView-1">fitInView</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>, Qt::AspectRatioMode <i>aspectRatioMode</i> = Qt::IgnoreAspectRatio)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#fitInView-2">fitInView</a></b>(const QGraphicsItem *<i>item</i>, Qt::AspectRatioMode <i>aspectRatioMode</i> = Qt::IgnoreAspectRatio)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#foregroundBrush-prop">foregroundBrush</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#interactive-prop">isInteractive</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#isTransformed">isTransformed</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsItem *</td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#itemAt">itemAt</a></b>(const QPoint &amp;<i>pos</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsItem *</td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#itemAt-1">itemAt</a></b>(int <i>x</i>, int <i>y</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#items">items</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#items-1">items</a></b>(const QPoint &amp;<i>pos</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#items-2">items</a></b>(int <i>x</i>, int <i>y</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#items-3">items</a></b>(const QRect &amp;<i>rect</i>, Qt::ItemSelectionMode <i>mode</i> = Qt::IntersectsItemShape) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#items-4">items</a></b>(int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, Qt::ItemSelectionMode <i>mode</i> = Qt::IntersectsItemShape) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#items-5">items</a></b>(const QPolygon &amp;<i>polygon</i>, Qt::ItemSelectionMode <i>mode</i> = Qt::IntersectsItemShape) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#items-6">items</a></b>(const QPainterPath &amp;<i>path</i>, Qt::ItemSelectionMode <i>mode</i> = Qt::IntersectsItemShape) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapFromScene">mapFromScene</a></b>(const QPointF &amp;<i>point</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapFromScene-1">mapFromScene</a></b>(const QRectF &amp;<i>rect</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapFromScene-2">mapFromScene</a></b>(const QPolygonF &amp;<i>polygon</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapFromScene-3">mapFromScene</a></b>(const QPainterPath &amp;<i>path</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapFromScene-4">mapFromScene</a></b>(qreal <i>x</i>, qreal <i>y</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapFromScene-5">mapFromScene</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPointF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapToScene">mapToScene</a></b>(const QPoint &amp;<i>point</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygonF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapToScene-1">mapToScene</a></b>(const QRect &amp;<i>rect</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygonF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapToScene-2">mapToScene</a></b>(const QPolygon &amp;<i>polygon</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapToScene-3">mapToScene</a></b>(const QPainterPath &amp;<i>path</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPointF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapToScene-4">mapToScene</a></b>(int <i>x</i>, int <i>y</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygonF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mapToScene-5">mapToScene</a></b>(int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#matrix">matrix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> OptimizationFlags </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#optimizationFlags-prop">optimizationFlags</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#render">render</a></b>(QPainter *<i>painter</i>, const QRectF &amp;<i>target</i> = QRectF(), const QRect &amp;<i>source</i> = QRect(), Qt::AspectRatioMode <i>aspectRatioMode</i> = Qt::KeepAspectRatio)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainter::RenderHints </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#renderHints-prop">renderHints</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#resetCachedContent">resetCachedContent</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#resetMatrix">resetMatrix</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#resetTransform">resetTransform</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ViewportAnchor </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#resizeAnchor-prop">resizeAnchor</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#rotate">rotate</a></b>(qreal <i>angle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#rubberBandRect">rubberBandRect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::ItemSelectionMode </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#rubberBandSelectionMode-prop">rubberBandSelectionMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#scale">scale</a></b>(qreal <i>sx</i>, qreal <i>sy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsScene *</td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#scene">scene</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#sceneRect-prop">sceneRect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#alignment-prop">setAlignment</a></b>(Qt::Alignment <i>alignment</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#backgroundBrush-prop">setBackgroundBrush</a></b>(const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#cacheMode-prop">setCacheMode</a></b>(CacheMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#dragMode-prop">setDragMode</a></b>(DragMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#foregroundBrush-prop">setForegroundBrush</a></b>(const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#interactive-prop">setInteractive</a></b>(bool <i>allowed</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#setMatrix">setMatrix</a></b>(const QMatrix &amp;<i>matrix</i>, bool <i>combine</i> = false)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#setOptimizationFlag">setOptimizationFlag</a></b>(OptimizationFlag <i>flag</i>, bool <i>enabled</i> = true)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#optimizationFlags-prop">setOptimizationFlags</a></b>(OptimizationFlags <i>flags</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#setRenderHint">setRenderHint</a></b>(QPainter::RenderHint <i>hint</i>, bool <i>enabled</i> = true)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#renderHints-prop">setRenderHints</a></b>(QPainter::RenderHints <i>hints</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#resizeAnchor-prop">setResizeAnchor</a></b>(ViewportAnchor <i>anchor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#rubberBandSelectionMode-prop">setRubberBandSelectionMode</a></b>(Qt::ItemSelectionMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#setScene">setScene</a></b>(QGraphicsScene *<i>scene</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#sceneRect-prop">setSceneRect</a></b>(const QRectF &amp;<i>rect</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#sceneRect-prop">setSceneRect</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#setTransform">setTransform</a></b>(const QTransform &amp;<i>matrix</i>, bool <i>combine</i> = false)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#transformationAnchor-prop">setTransformationAnchor</a></b>(ViewportAnchor <i>anchor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#viewportUpdateMode-prop">setViewportUpdateMode</a></b>(ViewportUpdateMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#shear">shear</a></b>(qreal <i>sh</i>, qreal <i>sv</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#transform">transform</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ViewportAnchor </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#transformationAnchor-prop">transformationAnchor</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#translate">translate</a></b>(qreal <i>dx</i>, qreal <i>dy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#viewportTransform">viewportTransform</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ViewportUpdateMode </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#viewportUpdateMode-prop">viewportUpdateMode</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 QVariant </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#inputMethodQuery">inputMethodQuery</a></b>(Qt::InputMethodQuery <i>query</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#sizeHint">sizeHint</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">20 public functions inherited from <a href="qabstractscrollarea.html#public-functions">QAbstractScrollArea</a></li>
<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="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#invalidateScene">invalidateScene</a></b>(const QRectF &amp;<i>rect</i> = QRectF(), QGraphicsScene::SceneLayers <i>layers</i> = QGraphicsScene::AllLayers)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#updateScene">updateScene</a></b>(const QList&lt;QRectF&gt; &amp;<i>rects</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#updateSceneRect">updateSceneRect</a></b>(const QRectF &amp;<i>rect</i>)</td></tr>
</table></div>
<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>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#rubberBandChanged">rubberBandChanged</a></b>(QRect <i>rubberBandRect</i>, QPointF <i>fromScenePoint</i>, QPointF <i>toScenePoint</i>)</td></tr>
</table></div>
<ul>
<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>
</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="qgraphicsview.html#drawBackground">drawBackground</a></b>(QPainter *<i>painter</i>, const QRectF &amp;<i>rect</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#drawForeground">drawForeground</a></b>(QPainter *<i>painter</i>, const QRectF &amp;<i>rect</i>)</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="qgraphicsview.html#contextMenuEvent">contextMenuEvent</a></b>(QContextMenuEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.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="qgraphicsview.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="qgraphicsview.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="qgraphicsview.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="qgraphicsview.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="qgraphicsview.html#focusInEvent">focusInEvent</a></b>(QFocusEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#focusNextPrevChild">focusNextPrevChild</a></b>(bool <i>next</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#focusOutEvent">focusOutEvent</a></b>(QFocusEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#inputMethodEvent">inputMethodEvent</a></b>(QInputMethodEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#keyPressEvent">keyPressEvent</a></b>(QKeyEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#keyReleaseEvent">keyReleaseEvent</a></b>(QKeyEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b>(QMouseEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mouseMoveEvent">mouseMoveEvent</a></b>(QMouseEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mousePressEvent">mousePressEvent</a></b>(QMouseEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#mouseReleaseEvent">mouseReleaseEvent</a></b>(QMouseEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.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="qgraphicsview.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="qgraphicsview.html#scrollContentsBy">scrollContentsBy</a></b>(int <i>dx</i>, int <i>dy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#showEvent">showEvent</a></b>(QShowEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#viewportEvent">viewportEvent</a></b>(QEvent *<i>event</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#wheelEvent">wheelEvent</a></b>(QWheelEvent *<i>event</i>)</td></tr>
</table></div>
<ul>
<li class="fn">20 protected functions inherited from <a href="qabstractscrollarea.html#protected-functions">QAbstractScrollArea</a></li>
<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>
<a name="protected-slots"></a>
<h2 id="protected-slots">Protected Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsview.html#setupViewport">setupViewport</a></b>(QWidget *<i>widget</i>)</td></tr>
</table></div>
<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">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">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>
<!-- $$$QGraphicsView-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qgraphicsview.html">QGraphicsView</a> class provides a widget for displaying the contents of a <a href="qgraphicsscene.html">QGraphicsScene</a>.</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> visualizes the contents of a <a href="qgraphicsscene.html">QGraphicsScene</a> in a scrollable viewport. To create a scene with geometrical items, see <a href="qgraphicsscene.html">QGraphicsScene</a>'s documentation. <a href="qgraphicsview.html">QGraphicsView</a> is part of the <a href="graphicsview.html">Graphics View Framework</a>.</p>
<p>To visualize a scene, you start by constructing a <a href="qgraphicsview.html">QGraphicsView</a> object, passing the address of the scene you want to visualize to <a href="qgraphicsview.html">QGraphicsView</a>'s constructor. Alternatively, you can call <a href="qgraphicsview.html#setScene">setScene</a>() to set the scene at a later point. After you call <a href="qwidget.html#show">show</a>(), the view will by default scroll to the center of the scene and display any items that are visible at this point. For example:</p>
<pre class="cpp">

  <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene;
  scene<span class="operator">.</span>addText(<span class="string">&quot;Hello, world!&quot;</span>);

  <span class="type"><a href="qgraphicsview.html#QGraphicsView">QGraphicsView</a></span> view(<span class="operator">&amp;</span>scene);
  view<span class="operator">.</span>show();

</pre>
<p>You can explicitly scroll to any position on the scene by using the scroll bars, or by calling <a href="qgraphicsview.html#centerOn">centerOn</a>(). By passing a point to <a href="qgraphicsview.html#centerOn">centerOn</a>(), <a href="qgraphicsview.html">QGraphicsView</a> will scroll its viewport to ensure that the point is centered in the view. An overload is provided for scrolling to a <a href="qgraphicsitem.html">QGraphicsItem</a>, in which case <a href="qgraphicsview.html">QGraphicsView</a> will see to that the center of the item is centered in the view. If all you want is to ensure that a certain area is visible, (but not necessarily centered,) you can call <a href="qgraphicsview.html#ensureVisible">ensureVisible</a>() instead.</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> can be used to visualize a whole scene, or only parts of it. The visualized area is by default detected automatically when the view is displayed for the first time (by calling <a href="qgraphicsscene.html#itemsBoundingRect">QGraphicsScene::itemsBoundingRect</a>()). To set the visualized area rectangle yourself, you can call <a href="qgraphicsview.html#sceneRect-prop">setSceneRect</a>(). This will adjust the scroll bars' ranges appropriately. Note that although the scene supports a virtually unlimited size, the range of the scroll bars will never exceed the range of an integer (INT_MIN, INT_MAX).</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> visualizes the scene by calling <a href="qgraphicsview.html#render">render</a>(). By default, the items are drawn onto the viewport by using a regular <a href="../qtgui/qpainter.html">QPainter</a>, and using default render hints. To change the default render hints that <a href="qgraphicsview.html">QGraphicsView</a> passes to <a href="../qtgui/qpainter.html">QPainter</a> when painting items, you can call <a href="qgraphicsview.html#renderHints-prop">setRenderHints</a>().</p>
<p>By default, <a href="qgraphicsview.html">QGraphicsView</a> provides a regular <a href="qwidget.html">QWidget</a> for the viewport widget. You can access this widget by calling <a href="qabstractscrollarea.html#viewport">viewport</a>(), or you can replace it by calling <a href="qabstractscrollarea.html#setViewport">setViewport</a>(). To render using OpenGL, simply call <a href="qabstractscrollarea.html#setViewport">setViewport</a>(new QGLWidget). <a href="qgraphicsview.html">QGraphicsView</a> takes ownership of the viewport widget.</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> supports affine transformations, using <a href="../qtgui/qtransform.html">QTransform</a>. You can either pass a matrix to <a href="qgraphicsview.html#setTransform">setTransform</a>(), or you can call one of the convenience functions <a href="qgraphicsview.html#rotate">rotate</a>(), <a href="qgraphicsview.html#scale">scale</a>(), <a href="qgraphicsview.html#translate">translate</a>() or <a href="qgraphicsview.html#shear">shear</a>(). The most two common transformations are scaling, which is used to implement zooming, and rotation. <a href="qgraphicsview.html">QGraphicsView</a> keeps the center of the view fixed during a transformation. Because of the scene alignment (setAligment()), translating the view will have no visual impact.</p>
<p>You can interact with the items on the scene by using the mouse and keyboard. <a href="qgraphicsview.html">QGraphicsView</a> translates the mouse and key events into <i>scene</i> events, (events that inherit <a href="qgraphicssceneevent.html">QGraphicsSceneEvent</a>,), and forward them to the visualized scene. In the end, it's the individual item that handles the events and reacts to them. For example, if you click on a selectable item, the item will typically let the scene know that it has been selected, and it will also redraw itself to display a selection rectangle. Similiary, if you click and drag the mouse to move a movable item, it's the item that handles the mouse moves and moves itself. Item interaction is enabled by default, and you can toggle it by calling <a href="qgraphicsview.html#interactive-prop">setInteractive</a>().</p>
<p>You can also provide your own custom scene interaction, by creating a subclass of <a href="qgraphicsview.html">QGraphicsView</a>, and reimplementing the mouse and key event handlers. To simplify how you programmatically interact with items in the view, <a href="qgraphicsview.html">QGraphicsView</a> provides the mapping functions <a href="qgraphicsview.html#mapToScene">mapToScene</a>() and <a href="qgraphicsview.html#mapFromScene">mapFromScene</a>(), and the item accessors <a href="qgraphicsview.html#items">items</a>() and <a href="qgraphicsview.html#itemAt">itemAt</a>(). These functions allow you to map points, rectangles, polygons and paths between view coordinates and scene coordinates, and to find items on the scene using view coordinates.</p>
<p class="centerAlign"><img src="images/graphicsview-view.png" alt="" /></p></div>
<p><b>See also </b><a href="qgraphicsscene.html">QGraphicsScene</a>, <a href="qgraphicsitem.html">QGraphicsItem</a>, and <a href="qgraphicssceneevent.html">QGraphicsSceneEvent</a>.</p>
<!-- @@@QGraphicsView -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$CacheModeFlag$$$CacheNone$$$CacheBackground -->
<h3 class="flags" id="CacheModeFlag-enum"><a name="CacheModeFlag-enum"></a>enum QGraphicsView::<span class="name">CacheModeFlag</span><br/>flags QGraphicsView::<span class="name">CacheMode</span></h3>
<p>This enum describes the flags that you can set for a <a href="qgraphicsview.html">QGraphicsView</a>'s cache mode.</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>QGraphicsView::CacheNone</code></td><td class="topAlign tblval"><code>0x0</code></td><td class="topAlign">All painting is done directly onto the viewport.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::CacheBackground</code></td><td class="topAlign tblval"><code>0x1</code></td><td class="topAlign">The background is cached. This affects both custom backgrounds, and backgrounds based on the <a href="qgraphicsview.html#backgroundBrush-prop">backgroundBrush</a> property. When this flag is enabled, <a href="qgraphicsview.html">QGraphicsView</a> will allocate one pixmap with the full size of the viewport.</td></tr>
</table></div>
<p>The CacheMode type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;CacheModeFlag&gt;. It stores an OR combination of CacheModeFlag values.</p>
<p><b>See also </b><a href="qgraphicsview.html#cacheMode-prop">cacheMode</a>.</p>
<!-- @@@CacheModeFlag -->
<!-- $$$DragMode$$$NoDrag$$$ScrollHandDrag$$$RubberBandDrag -->
<h3 class="fn" id="DragMode-enum"><a name="DragMode-enum"></a>enum QGraphicsView::<span class="name">DragMode</span></h3>
<p>This enum describes the default action for the view when pressing and dragging the mouse over the viewport.</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>QGraphicsView::NoDrag</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Nothing happens; the mouse event is ignored.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::ScrollHandDrag</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The cursor changes into a pointing hand, and dragging the mouse around will scroll the scrolbars. This mode works both in <a href="qgraphicsview.html#interactive-prop">interactive</a> and non-interactive mode.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::RubberBandDrag</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">A rubber band will appear. Dragging the mouse will set the rubber band geometry, and all items covered by the rubber band are selected. This mode is disabled for non-interactive views.</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsview.html#dragMode-prop">dragMode</a> and <a href="qgraphicsscene.html#setSelectionArea">QGraphicsScene::setSelectionArea</a>().</p>
<!-- @@@DragMode -->
<!-- $$$OptimizationFlag$$$DontClipPainter$$$DontSavePainterState$$$DontAdjustForAntialiasing$$$IndirectPainting -->
<h3 class="flags" id="OptimizationFlag-enum"><a name="OptimizationFlag-enum"></a>enum QGraphicsView::<span class="name">OptimizationFlag</span><br/>flags QGraphicsView::<span class="name">OptimizationFlags</span></h3>
<p>This enum describes flags that you can enable to improve rendering performance in <a href="qgraphicsview.html">QGraphicsView</a>. By default, none of these flags are set. Note that setting a flag usually imposes a side effect, and this effect can vary between paint devices and platforms.</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>QGraphicsView::DontClipPainter</code></td><td class="topAlign tblval"><code>0x1</code></td><td class="topAlign">This value is obsolete and has no effect.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::DontSavePainterState</code></td><td class="topAlign tblval"><code>0x2</code></td><td class="topAlign">When rendering, <a href="qgraphicsview.html">QGraphicsView</a> protects the painter state (see <a href="../qtgui/qpainter.html#save">QPainter::save</a>()) when rendering the background or foreground, and when rendering each item. This allows you to leave the painter in an altered state (i.e&#x2e;, you can call <a href="../qtgui/qpainter.html#setPen-2">QPainter::setPen</a>() or <a href="../qtgui/qpainter.html#setBrush-1">QPainter::setBrush</a>() without restoring the state after painting). However, if the items consistently do restore the state, you should enable this flag to prevent <a href="qgraphicsview.html">QGraphicsView</a> from doing the same.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::DontAdjustForAntialiasing</code></td><td class="topAlign tblval"><code>0x4</code></td><td class="topAlign">Disables <a href="qgraphicsview.html">QGraphicsView</a>'s antialiasing auto-adjustment of exposed areas. Items that render antialiased lines on the boundaries of their <a href="qgraphicsitem.html#boundingRect">QGraphicsItem::boundingRect</a>() can end up rendering parts of the line outside. To prevent rendering artifacts, <a href="qgraphicsview.html">QGraphicsView</a> expands all exposed regions by 2 pixels in all directions. If you enable this flag, <a href="qgraphicsview.html">QGraphicsView</a> will no longer perform these adjustments, minimizing the areas that require redrawing, which improves performance. A common side effect is that items that do draw with antialiasing can leave painting traces behind on the scene as they are moved.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::IndirectPainting</code></td><td class="topAlign tblval"><code>0x8</code></td><td class="topAlign">Since Qt 4.6, restore the old painting algorithm that calls QGraphicsView::drawItems() and QGraphicsScene::drawItems(). To be used only for compatibility with old code.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 4.3.</p>
<p>The OptimizationFlags type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;OptimizationFlag&gt;. It stores an OR combination of OptimizationFlag values.</p>
<!-- @@@OptimizationFlag -->
<!-- $$$ViewportAnchor$$$NoAnchor$$$AnchorViewCenter$$$AnchorUnderMouse -->
<h3 class="fn" id="ViewportAnchor-enum"><a name="ViewportAnchor-enum"></a>enum QGraphicsView::<span class="name">ViewportAnchor</span></h3>
<p>This enums describe the possible anchors that <a href="qgraphicsview.html">QGraphicsView</a> can use when the user resizes the view or when the view is transformed.</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>QGraphicsView::NoAnchor</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">No anchor, i.e&#x2e; the view leaves the scene's position unchanged.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::AnchorViewCenter</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The scene point at the center of the view is used as the anchor.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::AnchorUnderMouse</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The point under the mouse is used as the anchor.</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsview.html#resizeAnchor-prop">resizeAnchor</a> and <a href="qgraphicsview.html#transformationAnchor-prop">transformationAnchor</a>.</p>
<!-- @@@ViewportAnchor -->
<!-- $$$ViewportUpdateMode$$$FullViewportUpdate$$$MinimalViewportUpdate$$$SmartViewportUpdate$$$NoViewportUpdate$$$BoundingRectViewportUpdate -->
<h3 class="fn" id="ViewportUpdateMode-enum"><a name="ViewportUpdateMode-enum"></a>enum QGraphicsView::<span class="name">ViewportUpdateMode</span></h3>
<p>This enum describes how <a href="qgraphicsview.html">QGraphicsView</a> updates its viewport when the scene contents change or are exposed.</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>QGraphicsView::FullViewportUpdate</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">When any visible part of the scene changes or is reexposed, <a href="qgraphicsview.html">QGraphicsView</a> will update the entire viewport. This approach is fastest when <a href="qgraphicsview.html">QGraphicsView</a> spends more time figuring out what to draw than it would spend drawing (e.g&#x2e;, when very many small items are repeatedly updated). This is the preferred update mode for viewports that do not support partial updates, such as QGLWidget, and for viewports that need to disable scroll optimization.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::MinimalViewportUpdate</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign"><a href="qgraphicsview.html">QGraphicsView</a> will determine the minimal viewport region that requires a redraw, minimizing the time spent drawing by avoiding a redraw of areas that have not changed. This is <a href="qgraphicsview.html">QGraphicsView</a>'s default mode. Although this approach provides the best performance in general, if there are many small visible changes on the scene, <a href="qgraphicsview.html">QGraphicsView</a> might end up spending more time finding the minimal approach than it will spend drawing.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::SmartViewportUpdate</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign"><a href="qgraphicsview.html">QGraphicsView</a> will attempt to find an optimal update mode by analyzing the areas that require a redraw.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::BoundingRectViewportUpdate</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">The bounding rectangle of all changes in the viewport will be redrawn. This mode has the advantage that <a href="qgraphicsview.html">QGraphicsView</a> searches only one region for changes, minimizing time spent determining what needs redrawing. The disadvantage is that areas that have not changed also need to be redrawn.</td></tr>
<tr><td class="topAlign"><code>QGraphicsView::NoViewportUpdate</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign"><a href="qgraphicsview.html">QGraphicsView</a> will never update its viewport when the scene changes; the user is expected to control all updates. This mode disables all (potentially slow) item visibility testing in <a href="qgraphicsview.html">QGraphicsView</a>, and is suitable for scenes that either require a fixed frame rate, or where the viewport is otherwise updated externally.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 4.3.</p>
<p><b>See also </b><a href="qgraphicsview.html#viewportUpdateMode-prop">viewportUpdateMode</a>.</p>
<!-- @@@ViewportUpdateMode -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$alignment-prop$$$alignment$$$setAlignmentQt::Alignment -->
<h3 class="fn" id="alignment-prop"><a name="alignment-prop"></a><span class="name">alignment</span> : <span class="type"><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::Alignment</a></span></h3>
<p>This property holds the alignment of the scene in the view when the whole scene is visible.</p>
<p>If the whole scene is visible in the view, (i.e&#x2e;, there are no visible scroll bars,) the view's alignment will decide where the scene will be rendered in the view. For example, if the alignment is <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignCenter</a>, which is default, the scene will be centered in the view, and if the alignment is (<a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignLeft</a> | <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignTop</a>), the scene will be rendered in the top-left corner of the view.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><span class="name"><b>alignment</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setAlignment</b></span>(Qt::Alignment <i>alignment</i>)</td></tr>
</table></div>
<!-- @@@alignment -->
<!-- $$$backgroundBrush-prop$$$backgroundBrush$$$setBackgroundBrushconstQBrush& -->
<h3 class="fn" id="backgroundBrush-prop"><a name="backgroundBrush-prop"></a><span class="name">backgroundBrush</span> : <span class="type"><a href="../qtgui/qbrush.html">QBrush</a></span></h3>
<p>This property holds the background brush of the scene.</p>
<p>This property sets the background brush for the scene in this view. It is used to override the scene's own background, and defines the behavior of <a href="qgraphicsview.html#drawBackground">drawBackground</a>(). To provide custom background drawing for this view, you can reimplement <a href="qgraphicsview.html#drawBackground">drawBackground</a>() instead.</p>
<p>By default, this property contains a brush with the <a href="../qtcore/qt.html#BrushStyle-enum">Qt::NoBrush</a> pattern.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QBrush </td><td class="memItemRight bottomAlign"><span class="name"><b>backgroundBrush</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setBackgroundBrush</b></span>(const QBrush &amp;<i>brush</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsscene.html#backgroundBrush-prop">QGraphicsScene::backgroundBrush</a> and <a href="qgraphicsview.html#foregroundBrush-prop">foregroundBrush</a>.</p>
<!-- @@@backgroundBrush -->
<!-- $$$cacheMode-prop$$$cacheMode$$$setCacheModeCacheMode -->
<h3 class="fn" id="cacheMode-prop"><a name="cacheMode-prop"></a><span class="name">cacheMode</span> : <span class="type"><a href="qgraphicsview.html#CacheModeFlag-enum">CacheMode</a></span></h3>
<p>This property holds which parts of the view are cached</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> can cache pre-rendered content in a <a href="../qtgui/qpixmap.html">QPixmap</a>, which is then drawn onto the viewport. The purpose of such caching is to speed up the total rendering time for areas that are slow to render. Texture, gradient and alpha blended backgrounds, for example, can be notibly slow to render; especially with a transformed view. The <a href="qgraphicsview.html#CacheModeFlag-enum">CacheBackground</a> flag enables caching of the view's background. For example:</p>
<pre class="cpp">

  <span class="type"><a href="qgraphicsview.html#QGraphicsView">QGraphicsView</a></span> view;
  view<span class="operator">.</span>setBackgroundBrush(<span class="type"><a href="../qtgui/qimage.html">QImage</a></span>(<span class="string">&quot;:/images/backgroundtile.png&quot;</span>));
  view<span class="operator">.</span>setCacheMode(<span class="type"><a href="qgraphicsview.html#QGraphicsView">QGraphicsView</a></span><span class="operator">::</span>CacheBackground);

</pre>
<p>The cache is invalidated every time the view is transformed. However, when scrolling, only partial invalidation is required.</p>
<p>By default, nothing is cached.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> CacheMode </td><td class="memItemRight bottomAlign"><span class="name"><b>cacheMode</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setCacheMode</b></span>(CacheMode <i>mode</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsview.html#resetCachedContent">resetCachedContent</a>() and <a href="../qtgui/qpixmapcache.html">QPixmapCache</a>.</p>
<!-- @@@cacheMode -->
<!-- $$$dragMode-prop$$$dragMode$$$setDragModeDragMode -->
<h3 class="fn" id="dragMode-prop"><a name="dragMode-prop"></a><span class="name">dragMode</span> : <span class="type"><a href="qgraphicsview.html#DragMode-enum">DragMode</a></span></h3>
<p>This property holds the behavior for dragging the mouse over the scene while the left mouse button is pressed.</p>
<p>This property defines what should happen when the user clicks on the scene background and drags the mouse (e.g&#x2e;, scrolling the viewport contents using a pointing hand cursor, or selecting multiple items with a rubber band). The default value, <a href="qgraphicsview.html#DragMode-enum">NoDrag</a>, does nothing.</p>
<p>This behavior only affects mouse clicks that are not handled by any item. You can define a custom behavior by creating a subclass of <a href="qgraphicsview.html">QGraphicsView</a> and reimplementing <a href="qgraphicsview.html#mouseMoveEvent">mouseMoveEvent</a>().</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> DragMode </td><td class="memItemRight bottomAlign"><span class="name"><b>dragMode</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDragMode</b></span>(DragMode <i>mode</i>)</td></tr>
</table></div>
<!-- @@@dragMode -->
<!-- $$$foregroundBrush-prop$$$foregroundBrush$$$setForegroundBrushconstQBrush& -->
<h3 class="fn" id="foregroundBrush-prop"><a name="foregroundBrush-prop"></a><span class="name">foregroundBrush</span> : <span class="type"><a href="../qtgui/qbrush.html">QBrush</a></span></h3>
<p>This property holds the foreground brush of the scene.</p>
<p>This property sets the foreground brush for the scene in this view. It is used to override the scene's own foreground, and defines the behavior of <a href="qgraphicsview.html#drawForeground">drawForeground</a>(). To provide custom foreground drawing for this view, you can reimplement <a href="qgraphicsview.html#drawForeground">drawForeground</a>() instead.</p>
<p>By default, this property contains a brush with the <a href="../qtcore/qt.html#BrushStyle-enum">Qt::NoBrush</a> pattern.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QBrush </td><td class="memItemRight bottomAlign"><span class="name"><b>foregroundBrush</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setForegroundBrush</b></span>(const QBrush &amp;<i>brush</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsscene.html#foregroundBrush-prop">QGraphicsScene::foregroundBrush</a> and <a href="qgraphicsview.html#backgroundBrush-prop">backgroundBrush</a>.</p>
<!-- @@@foregroundBrush -->
<!-- $$$interactive-prop$$$isInteractive$$$setInteractivebool -->
<h3 class="fn" id="interactive-prop"><a name="interactive-prop"></a><span class="name">interactive</span> : <span class="type">bool</span></h3>
<p>This property holds whether the view allows scene interaction.</p>
<p>If enabled, this view is set to allow scene interaction. Otherwise, this view will not allow interaction, and any mouse or key events are ignored (i.e&#x2e;, it will act as a read-only view).</p>
<p>By default, this property is <code>true</code>.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isInteractive</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setInteractive</b></span>(bool <i>allowed</i>)</td></tr>
</table></div>
<!-- @@@interactive -->
<!-- $$$optimizationFlags-prop$$$optimizationFlags$$$setOptimizationFlagsOptimizationFlags -->
<h3 class="fn" id="optimizationFlags-prop"><a name="optimizationFlags-prop"></a><span class="name">optimizationFlags</span> : <span class="type"><a href="qgraphicsview.html#OptimizationFlag-enum">OptimizationFlags</a></span></h3>
<p>flags that can be used to tune <a href="qgraphicsview.html">QGraphicsView</a>'s performance.</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> uses clipping, extra bounding rect adjustments, and certain other aids to improve rendering quality and performance for the common case graphics scene. However, depending on the target platform, the scene, and the viewport in use, some of these operations can degrade performance.</p>
<p>The effect varies from flag to flag; see the <a href="qgraphicsview.html#OptimizationFlag-enum">OptimizationFlags</a> documentation for details.</p>
<p>By default, no optimization flags are enabled.</p>
<p>This property was introduced in  Qt 4.3.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> OptimizationFlags </td><td class="memItemRight bottomAlign"><span class="name"><b>optimizationFlags</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setOptimizationFlags</b></span>(OptimizationFlags <i>flags</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsview.html#setOptimizationFlag">setOptimizationFlag</a>().</p>
<!-- @@@optimizationFlags -->
<!-- $$$renderHints-prop$$$renderHints$$$setRenderHintsQPainter::RenderHints -->
<h3 class="fn" id="renderHints-prop"><a name="renderHints-prop"></a><span class="name">renderHints</span> : <span class="type"><a href="../qtgui/qpainter.html#RenderHint-enum">QPainter::RenderHints</a></span></h3>
<p>This property holds the default render hints for the view</p>
<p>These hints are used to initialize <a href="../qtgui/qpainter.html">QPainter</a> before each visible item is drawn. <a href="../qtgui/qpainter.html">QPainter</a> uses render hints to toggle rendering features such as antialiasing and smooth pixmap transformation.</p>
<p><a href="../qtgui/qpainter.html#RenderHint-enum">QPainter::TextAntialiasing</a> is enabled by default.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene;
  scene<span class="operator">.</span>addRect(<span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span>(<span class="operator">-</span><span class="number">10</span><span class="operator">,</span> <span class="operator">-</span><span class="number">10</span><span class="operator">,</span> <span class="number">20</span><span class="operator">,</span> <span class="number">20</span>));

  <span class="type"><a href="qgraphicsview.html#QGraphicsView">QGraphicsView</a></span> view(<span class="operator">&amp;</span>scene);
  view<span class="operator">.</span>setRenderHints(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span><span class="operator">::</span>Antialiasing <span class="operator">|</span> <span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span><span class="operator">::</span>SmoothPixmapTransform);
  view<span class="operator">.</span>show();

</pre>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QPainter::RenderHints </td><td class="memItemRight bottomAlign"><span class="name"><b>renderHints</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setRenderHints</b></span>(QPainter::RenderHints <i>hints</i>)</td></tr>
</table></div>
<!-- @@@renderHints -->
<!-- $$$resizeAnchor-prop$$$resizeAnchor$$$setResizeAnchorViewportAnchor -->
<h3 class="fn" id="resizeAnchor-prop"><a name="resizeAnchor-prop"></a><span class="name">resizeAnchor</span> : <span class="type"><a href="qgraphicsview.html#ViewportAnchor-enum">ViewportAnchor</a></span></h3>
<p>how the view should position the scene when the view is resized.</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> uses this property to decide how to position the scene in the viewport when the viewport widget's size changes. The default behavior, <a href="qgraphicsview.html#ViewportAnchor-enum">NoAnchor</a>, leaves the scene's position unchanged during a resize; the top-left corner of the view will appear to be anchored while resizing.</p>
<p>Note that the effect of this property is noticeable when only a part of the scene is visible (i.e&#x2e;, when there are scroll bars). Otherwise, if the whole scene fits in the view, <a href="qgraphicsscene.html">QGraphicsScene</a> uses the view <a href="stylesheet-reference.html#alignment">alignment</a> to position the scene in the view.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> ViewportAnchor </td><td class="memItemRight bottomAlign"><span class="name"><b>resizeAnchor</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setResizeAnchor</b></span>(ViewportAnchor <i>anchor</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="stylesheet-reference.html#alignment">alignment</a> and <a href="qgraphicsview.html#transformationAnchor-prop">transformationAnchor</a>.</p>
<!-- @@@resizeAnchor -->
<!-- $$$rubberBandSelectionMode-prop$$$rubberBandSelectionMode$$$setRubberBandSelectionModeQt::ItemSelectionMode -->
<h3 class="fn" id="rubberBandSelectionMode-prop"><a name="rubberBandSelectionMode-prop"></a><span class="name">rubberBandSelectionMode</span> : <span class="type"><a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span></h3>
<p>This property holds the behavior for selecting items with a rubber band selection rectangle.</p>
<p>This property defines how items are selected when using the <a href="qgraphicsview.html#DragMode-enum">RubberBandDrag</a> drag mode.</p>
<p>The default value is <a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::IntersectsItemShape</a>; all items whose shape intersects with or is contained by the rubber band are selected.</p>
<p>This property was introduced in  Qt 4.3.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> Qt::ItemSelectionMode </td><td class="memItemRight bottomAlign"><span class="name"><b>rubberBandSelectionMode</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setRubberBandSelectionMode</b></span>(Qt::ItemSelectionMode <i>mode</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsview.html#dragMode-prop">dragMode</a>, <a href="qgraphicsview.html#items">items</a>(), and <a href="qgraphicsview.html#rubberBandRect">rubberBandRect</a>().</p>
<!-- @@@rubberBandSelectionMode -->
<!-- $$$sceneRect-prop$$$sceneRect$$$setSceneRectconstQRectF&$$$setSceneRectqrealqrealqrealqreal -->
<h3 class="fn" id="sceneRect-prop"><a name="sceneRect-prop"></a><span class="name">sceneRect</span> : <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span></h3>
<p>This property holds the area of the scene visualized by this view.</p>
<p>The scene rectangle defines the extent of the scene, and in the view's case, this means the area of the scene that you can navigate using the scroll bars.</p>
<p>If unset, or if a null <a href="../qtcore/qrectf.html">QRectF</a> is set, this property has the same value as <a href="qgraphicsscene.html#sceneRect-prop">QGraphicsScene::sceneRect</a>, and it changes with <a href="qgraphicsscene.html#sceneRect-prop">QGraphicsScene::sceneRect</a>. Otherwise, the view's scene rect is unaffected by the scene.</p>
<p>Note that, although the scene supports a virtually unlimited size, the range of the scroll bars will never exceed the range of an integer (INT_MIN, INT_MAX). When the scene is larger than the scroll bars' values, you can choose to use <a href="qgraphicsview.html#translate">translate</a>() to navigate the scene instead.</p>
<p>By default, this property contains a rectangle at the origin with zero width and height.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QRectF </td><td class="memItemRight bottomAlign"><span class="name"><b>sceneRect</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSceneRect</b></span>(const QRectF &amp;<i>rect</i>)</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSceneRect</b></span>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsscene.html#sceneRect-prop">QGraphicsScene::sceneRect</a>.</p>
<!-- @@@sceneRect -->
<!-- $$$transformationAnchor-prop$$$transformationAnchor$$$setTransformationAnchorViewportAnchor -->
<h3 class="fn" id="transformationAnchor-prop"><a name="transformationAnchor-prop"></a><span class="name">transformationAnchor</span> : <span class="type"><a href="qgraphicsview.html#ViewportAnchor-enum">ViewportAnchor</a></span></h3>
<p>how the view should position the scene during transformations.</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> uses this property to decide how to position the scene in the viewport when the transformation matrix changes, and the coordinate system of the view is transformed. The default behavior, <a href="qgraphicsview.html#ViewportAnchor-enum">AnchorViewCenter</a>, ensures that the scene point at the center of the view remains unchanged during transformations (e.g&#x2e;, when rotating, the scene will appear to rotate around the center of the view).</p>
<p>Note that the effect of this property is noticeable when only a part of the scene is visible (i.e&#x2e;, when there are scroll bars). Otherwise, if the whole scene fits in the view, <a href="qgraphicsscene.html">QGraphicsScene</a> uses the view <a href="stylesheet-reference.html#alignment">alignment</a> to position the scene in the view.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> ViewportAnchor </td><td class="memItemRight bottomAlign"><span class="name"><b>transformationAnchor</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTransformationAnchor</b></span>(ViewportAnchor <i>anchor</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="stylesheet-reference.html#alignment">alignment</a> and <a href="qgraphicsview.html#resizeAnchor-prop">resizeAnchor</a>.</p>
<!-- @@@transformationAnchor -->
<!-- $$$viewportUpdateMode-prop$$$viewportUpdateMode$$$setViewportUpdateModeViewportUpdateMode -->
<h3 class="fn" id="viewportUpdateMode-prop"><a name="viewportUpdateMode-prop"></a><span class="name">viewportUpdateMode</span> : <span class="type"><a href="qgraphicsview.html#ViewportUpdateMode-enum">ViewportUpdateMode</a></span></h3>
<p>how the viewport should update its contents.</p>
<p><a href="qgraphicsview.html">QGraphicsView</a> uses this property to decide how to update areas of the scene that have been reexposed or changed. Usually you do not need to modify this property, but there are some cases where doing so can improve rendering performance. See the <a href="qgraphicsview.html#ViewportUpdateMode-enum">ViewportUpdateMode</a> documentation for specific details.</p>
<p>The default value is <a href="qgraphicsview.html#ViewportUpdateMode-enum">MinimalViewportUpdate</a>, where <a href="qgraphicsview.html">QGraphicsView</a> will update as small an area of the viewport as possible when the contents change.</p>
<p>This property was introduced in  Qt 4.3.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> ViewportUpdateMode </td><td class="memItemRight bottomAlign"><span class="name"><b>viewportUpdateMode</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setViewportUpdateMode</b></span>(ViewportUpdateMode <i>mode</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qgraphicsview.html#ViewportUpdateMode-enum">ViewportUpdateMode</a> and <a href="qgraphicsview.html#cacheMode-prop">cacheMode</a>.</p>
<!-- @@@viewportUpdateMode -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QGraphicsView[overload1]$$$QGraphicsViewQWidget* -->
<h3 class="fn" id="QGraphicsView"><a name="QGraphicsView"></a>QGraphicsView::<span class="name">QGraphicsView</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a <a href="qgraphicsview.html">QGraphicsView</a>. <i>parent</i> is passed to <a href="qwidget.html">QWidget</a>'s constructor.</p>
<!-- @@@QGraphicsView -->
<!-- $$$QGraphicsView$$$QGraphicsViewQGraphicsScene*QWidget* -->
<h3 class="fn" id="QGraphicsView-1"><a name="QGraphicsView-1"></a>QGraphicsView::<span class="name">QGraphicsView</span>(<span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> *<i>scene</i>, <span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a <a href="qgraphicsview.html">QGraphicsView</a> and sets the visualized scene to <i>scene</i>. <i>parent</i> is passed to <a href="qwidget.html">QWidget</a>'s constructor.</p>
<!-- @@@QGraphicsView -->
<!-- $$$~QGraphicsView[overload1]$$$~QGraphicsView -->
<h3 class="fn" id="dtor.QGraphicsView"><a name="dtor.QGraphicsView"></a>QGraphicsView::<span class="name">~QGraphicsView</span>()</h3>
<p>Destructs the <a href="qgraphicsview.html">QGraphicsView</a> object.</p>
<!-- @@@~QGraphicsView -->
<!-- $$$centerOn[overload1]$$$centerOnconstQPointF& -->
<h3 class="fn" id="centerOn"><a name="centerOn"></a><span class="type">void</span> QGraphicsView::<span class="name">centerOn</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>pos</i>)</h3>
<p>Scrolls the contents of the viewport to ensure that the scene coordinate <i>pos</i>, is centered in the view.</p>
<p>Because <i>pos</i> is a floating point coordinate, and the scroll bars operate on integer coordinates, the centering is only an approximation.</p>
<p><b>Note: </b>If the item is close to or outside the border, it will be visible in the view, but not centered.</p><p><b>See also </b><a href="qgraphicsview.html#ensureVisible">ensureVisible</a>().</p>
<!-- @@@centerOn -->
<!-- $$$centerOn$$$centerOnqrealqreal -->
<h3 class="fn" id="centerOn-1"><a name="centerOn-1"></a><span class="type">void</span> QGraphicsView::<span class="name">centerOn</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>)</h3>
<p>This is an overloaded function.</p>
<p>This function is provided for convenience. It's equivalent to calling <a href="qgraphicsview.html#centerOn">centerOn</a>(<a href="../qtcore/qpointf.html">QPointF</a>(<i>x</i>, <i>y</i>)).</p>
<!-- @@@centerOn -->
<!-- $$$centerOn$$$centerOnconstQGraphicsItem* -->
<h3 class="fn" id="centerOn-2"><a name="centerOn-2"></a><span class="type">void</span> QGraphicsView::<span class="name">centerOn</span>(const <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *<i>item</i>)</h3>
<p>This is an overloaded function.</p>
<p>Scrolls the contents of the viewport to ensure that <i>item</i> is centered in the view.</p>
<p><b>See also </b><a href="qgraphicsview.html#ensureVisible">ensureVisible</a>().</p>
<!-- @@@centerOn -->
<!-- $$$contextMenuEvent[overload1]$$$contextMenuEventQContextMenuEvent* -->
<h3 class="fn" id="contextMenuEvent"><a name="contextMenuEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">contextMenuEvent</span>(<span class="type"><a href="../qtgui/qcontextmenuevent.html">QContextMenuEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget::contextMenuEvent</a>().</p>
<!-- @@@contextMenuEvent -->
<!-- $$$dragEnterEvent[overload1]$$$dragEnterEventQDragEnterEvent* -->
<h3 class="fn" id="dragEnterEvent"><a name="dragEnterEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<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>
<!-- @@@dragEnterEvent -->
<!-- $$$dragLeaveEvent[overload1]$$$dragLeaveEventQDragLeaveEvent* -->
<h3 class="fn" id="dragLeaveEvent"><a name="dragLeaveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<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>
<!-- @@@dragLeaveEvent -->
<!-- $$$dragMoveEvent[overload1]$$$dragMoveEventQDragMoveEvent* -->
<h3 class="fn" id="dragMoveEvent"><a name="dragMoveEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<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>
<!-- @@@dragMoveEvent -->
<!-- $$$drawBackground[overload1]$$$drawBackgroundQPainter*constQRectF& -->
<h3 class="fn" id="drawBackground"><a name="drawBackground"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">drawBackground</span>(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> *<i>painter</i>, const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i>)</h3>
<p>Draws the background of the scene using <i>painter</i>, before any items and the foreground are drawn. Reimplement this function to provide a custom background for this view.</p>
<p>If all you want is to define a color, texture or gradient for the background, you can call <a href="qgraphicsview.html#backgroundBrush-prop">setBackgroundBrush</a>() instead.</p>
<p>All painting is done in <i>scene</i> coordinates. <i>rect</i> is the exposed rectangle.</p>
<p>The default implementation fills <i>rect</i> using the view's <a href="qgraphicsview.html#backgroundBrush-prop">backgroundBrush</a>. If no such brush is defined (the default), the scene's drawBackground() function is called instead.</p>
<p><b>See also </b><a href="qgraphicsview.html#drawForeground">drawForeground</a>() and <a href="qgraphicsscene.html#drawBackground">QGraphicsScene::drawBackground</a>().</p>
<!-- @@@drawBackground -->
<!-- $$$drawForeground[overload1]$$$drawForegroundQPainter*constQRectF& -->
<h3 class="fn" id="drawForeground"><a name="drawForeground"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">drawForeground</span>(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> *<i>painter</i>, const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i>)</h3>
<p>Draws the foreground of the scene using <i>painter</i>, after the background and all items are drawn. Reimplement this function to provide a custom foreground for this view.</p>
<p>If all you want is to define a color, texture or gradient for the foreground, you can call <a href="qgraphicsview.html#foregroundBrush-prop">setForegroundBrush</a>() instead.</p>
<p>All painting is done in <i>scene</i> coordinates. <i>rect</i> is the exposed rectangle.</p>
<p>The default implementation fills <i>rect</i> using the view's <a href="qgraphicsview.html#foregroundBrush-prop">foregroundBrush</a>. If no such brush is defined (the default), the scene's drawForeground() function is called instead.</p>
<p><b>See also </b><a href="qgraphicsview.html#drawBackground">drawBackground</a>() and <a href="qgraphicsscene.html#drawForeground">QGraphicsScene::drawForeground</a>().</p>
<!-- @@@drawForeground -->
<!-- $$$dropEvent[overload1]$$$dropEventQDropEvent* -->
<h3 class="fn" id="dropEvent"><a name="dropEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<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>
<!-- @@@dropEvent -->
<!-- $$$ensureVisible[overload1]$$$ensureVisibleconstQRectF&intint -->
<h3 class="fn" id="ensureVisible"><a name="ensureVisible"></a><span class="type">void</span> QGraphicsView::<span class="name">ensureVisible</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i>, <span class="type">int</span> <i>xmargin</i> = 50, <span class="type">int</span> <i>ymargin</i> = 50)</h3>
<p>Scrolls the contents of the viewport so that the scene rectangle <i>rect</i> is visible, with margins specified in pixels by <i>xmargin</i> and <i>ymargin</i>. If the specified rect cannot be reached, the contents are scrolled to the nearest valid position. The default value for both margins is 50 pixels.</p>
<p><b>See also </b><a href="qgraphicsview.html#centerOn">centerOn</a>().</p>
<!-- @@@ensureVisible -->
<!-- $$$ensureVisible$$$ensureVisibleqrealqrealqrealqrealintint -->
<h3 class="fn" id="ensureVisible-1"><a name="ensureVisible-1"></a><span class="type">void</span> QGraphicsView::<span class="name">ensureVisible</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>w</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>h</i>, <span class="type">int</span> <i>xmargin</i> = 50, <span class="type">int</span> <i>ymargin</i> = 50)</h3>
<p>This is an overloaded function.</p>
<p>This function is provided for convenience. It's equivalent to calling <a href="qgraphicsview.html#ensureVisible">ensureVisible</a>(<a href="../qtcore/qrectf.html">QRectF</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>), <i>xmargin</i>, <i>ymargin</i>).</p>
<!-- @@@ensureVisible -->
<!-- $$$ensureVisible$$$ensureVisibleconstQGraphicsItem*intint -->
<h3 class="fn" id="ensureVisible-2"><a name="ensureVisible-2"></a><span class="type">void</span> QGraphicsView::<span class="name">ensureVisible</span>(const <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *<i>item</i>, <span class="type">int</span> <i>xmargin</i> = 50, <span class="type">int</span> <i>ymargin</i> = 50)</h3>
<p>This is an overloaded function.</p>
<p>Scrolls the contents of the viewport so that the center of item <i>item</i> is visible, with margins specified in pixels by <i>xmargin</i> and <i>ymargin</i>. If the specified point cannot be reached, the contents are scrolled to the nearest valid position. The default value for both margins is 50 pixels.</p>
<p><b>See also </b><a href="qgraphicsview.html#centerOn">centerOn</a>().</p>
<!-- @@@ensureVisible -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn" id="event"><a name="event"></a><code>[virtual protected] </code><span class="type">bool</span> QGraphicsView::<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>
<!-- @@@event -->
<!-- $$$fitInView[overload1]$$$fitInViewconstQRectF&Qt::AspectRatioMode -->
<h3 class="fn" id="fitInView"><a name="fitInView"></a><span class="type">void</span> QGraphicsView::<span class="name">fitInView</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i>, <span class="type"><a href="../qtcore/qt.html#AspectRatioMode-enum">Qt::AspectRatioMode</a></span> <i>aspectRatioMode</i> = Qt::IgnoreAspectRatio)</h3>
<p>Scales the view matrix and scrolls the scroll bars to ensure that the scene rectangle <i>rect</i> fits inside the viewport. <i>rect</i> must be inside the scene rect; otherwise, fitInView() cannot guarantee that the whole rect is visible.</p>
<p>This function keeps the view's rotation, translation, or shear. The view is scaled according to <i>aspectRatioMode</i>. <i>rect</i> will be centered in the view if it does not fit tightly.</p>
<p>It's common to call fitInView() from inside a reimplementation of <a href="qgraphicsview.html#resizeEvent">resizeEvent</a>(), to ensure that the whole scene, or parts of the scene, scales automatically to fit the new size of the viewport as the view is resized. Note though, that calling fitInView() from inside <a href="qgraphicsview.html#resizeEvent">resizeEvent</a>() can lead to unwanted resize recursion, if the new transformation toggles the automatic state of the scrollbars. You can toggle the scrollbar policies to always on or always off to prevent this (see <a href="qabstractscrollarea.html#horizontalScrollBarPolicy-prop">horizontalScrollBarPolicy</a>() and <a href="qabstractscrollarea.html#verticalScrollBarPolicy-prop">verticalScrollBarPolicy</a>()).</p>
<p>If <i>rect</i> is empty, or if the viewport is too small, this function will do nothing.</p>
<p><b>See also </b><a href="qgraphicsview.html#setTransform">setTransform</a>(), <a href="qgraphicsview.html#ensureVisible">ensureVisible</a>(), and <a href="qgraphicsview.html#centerOn">centerOn</a>().</p>
<!-- @@@fitInView -->
<!-- $$$fitInView$$$fitInViewqrealqrealqrealqrealQt::AspectRatioMode -->
<h3 class="fn" id="fitInView-1"><a name="fitInView-1"></a><span class="type">void</span> QGraphicsView::<span class="name">fitInView</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>w</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>h</i>, <span class="type"><a href="../qtcore/qt.html#AspectRatioMode-enum">Qt::AspectRatioMode</a></span> <i>aspectRatioMode</i> = Qt::IgnoreAspectRatio)</h3>
<p>This is an overloaded function.</p>
<p>This convenience function is equivalent to calling <a href="qgraphicsview.html#fitInView">fitInView</a>(<a href="../qtcore/qrectf.html">QRectF</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>), <i>aspectRatioMode</i>).</p>
<p><b>See also </b><a href="qgraphicsview.html#ensureVisible">ensureVisible</a>() and <a href="qgraphicsview.html#centerOn">centerOn</a>().</p>
<!-- @@@fitInView -->
<!-- $$$fitInView$$$fitInViewconstQGraphicsItem*Qt::AspectRatioMode -->
<h3 class="fn" id="fitInView-2"><a name="fitInView-2"></a><span class="type">void</span> QGraphicsView::<span class="name">fitInView</span>(const <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *<i>item</i>, <span class="type"><a href="../qtcore/qt.html#AspectRatioMode-enum">Qt::AspectRatioMode</a></span> <i>aspectRatioMode</i> = Qt::IgnoreAspectRatio)</h3>
<p>This is an overloaded function.</p>
<p>Ensures that <i>item</i> fits tightly inside the view, scaling the view according to <i>aspectRatioMode</i>.</p>
<p><b>See also </b><a href="qgraphicsview.html#ensureVisible">ensureVisible</a>() and <a href="qgraphicsview.html#centerOn">centerOn</a>().</p>
<!-- @@@fitInView -->
<!-- $$$focusInEvent[overload1]$$$focusInEventQFocusEvent* -->
<h3 class="fn" id="focusInEvent"><a name="focusInEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">focusInEvent</span>(<span class="type"><a href="../qtgui/qfocusevent.html">QFocusEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget::focusInEvent</a>().</p>
<!-- @@@focusInEvent -->
<!-- $$$focusNextPrevChild[overload1]$$$focusNextPrevChildbool -->
<h3 class="fn" id="focusNextPrevChild"><a name="focusNextPrevChild"></a><code>[virtual protected] </code><span class="type">bool</span> QGraphicsView::<span class="name">focusNextPrevChild</span>(<span class="type">bool</span> <i>next</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#focusNextPrevChild">QWidget::focusNextPrevChild</a>().</p>
<!-- @@@focusNextPrevChild -->
<!-- $$$focusOutEvent[overload1]$$$focusOutEventQFocusEvent* -->
<h3 class="fn" id="focusOutEvent"><a name="focusOutEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">focusOutEvent</span>(<span class="type"><a href="../qtgui/qfocusevent.html">QFocusEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget::focusOutEvent</a>().</p>
<!-- @@@focusOutEvent -->
<!-- $$$inputMethodEvent[overload1]$$$inputMethodEventQInputMethodEvent* -->
<h3 class="fn" id="inputMethodEvent"><a name="inputMethodEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">inputMethodEvent</span>(<span class="type"><a href="../qtgui/qinputmethodevent.html">QInputMethodEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#inputMethodEvent">QWidget::inputMethodEvent</a>().</p>
<!-- @@@inputMethodEvent -->
<!-- $$$inputMethodQuery[overload1]$$$inputMethodQueryQt::InputMethodQuery -->
<h3 class="fn" id="inputMethodQuery"><a name="inputMethodQuery"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QGraphicsView::<span class="name">inputMethodQuery</span>(<span class="type"><a href="../qtcore/qt.html#InputMethodQuery-enum">Qt::InputMethodQuery</a></span> <i>query</i>) const</h3>
<p>Reimplemented from <a href="qwidget.html#inputMethodQuery">QWidget::inputMethodQuery</a>().</p>
<!-- @@@inputMethodQuery -->
<!-- $$$invalidateScene[overload1]$$$invalidateSceneconstQRectF&QGraphicsScene::SceneLayers -->
<h3 class="fn" id="invalidateScene"><a name="invalidateScene"></a><code>[slot] </code><span class="type">void</span> QGraphicsView::<span class="name">invalidateScene</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i> = QRectF(), <span class="type"><a href="qgraphicsscene.html#SceneLayer-enum">QGraphicsScene::SceneLayers</a></span> <i>layers</i> = QGraphicsScene::AllLayers)</h3>
<p>Invalidates and schedules a redraw of <i>layers</i> inside <i>rect</i>. <i>rect</i> is in scene coordinates. Any cached content for <i>layers</i> inside <i>rect</i> is unconditionally invalidated and redrawn.</p>
<p>You can call this function to notify <a href="qgraphicsview.html">QGraphicsView</a> of changes to the background or the foreground of the scene. It is commonly used for scenes with tile-based backgrounds to notify changes when <a href="qgraphicsview.html">QGraphicsView</a> has enabled background caching.</p>
<p>Note that <a href="qgraphicsview.html">QGraphicsView</a> currently supports background caching only (see <a href="qgraphicsview.html#CacheModeFlag-enum">QGraphicsView::CacheBackground</a>). This function is equivalent to calling <a href="qwidget.html#update">update</a>() if any layer but <a href="qgraphicsscene.html#SceneLayer-enum">QGraphicsScene::BackgroundLayer</a> is passed.</p>
<p><b>See also </b><a href="qgraphicsscene.html#invalidate">QGraphicsScene::invalidate</a>() and <a href="qwidget.html#update">update</a>().</p>
<!-- @@@invalidateScene -->
<!-- $$$isTransformed[overload1]$$$isTransformed -->
<h3 class="fn" id="isTransformed"><a name="isTransformed"></a><span class="type">bool</span> QGraphicsView::<span class="name">isTransformed</span>() const</h3>
<p>Returns <code>true</code> if the view is transformed (i.e&#x2e;, a non-identity transform has been assigned, or the scrollbars are adjusted).</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qgraphicsview.html#setTransform">setTransform</a>(), <a href="qabstractscrollarea.html#horizontalScrollBar">horizontalScrollBar</a>(), and <a href="qabstractscrollarea.html#verticalScrollBar">verticalScrollBar</a>().</p>
<!-- @@@isTransformed -->
<!-- $$$itemAt[overload1]$$$itemAtconstQPoint& -->
<h3 class="fn" id="itemAt"><a name="itemAt"></a><span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *QGraphicsView::<span class="name">itemAt</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>pos</i>) const</h3>
<p>Returns the item at position <i>pos</i>, which is in viewport coordinates. If there are several items at this position, this function returns the topmost item.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type">void</span> CustomView<span class="operator">::</span>mousePressEvent(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> <span class="operator">*</span>event)
  {
      <span class="keyword">if</span> (<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> <span class="operator">*</span>item <span class="operator">=</span> itemAt(event<span class="operator">-</span><span class="operator">&gt;</span>pos())) {
          <a href="../qtcore/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;You clicked on item&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> item;
      } <span class="keyword">else</span> {
          <a href="../qtcore/qtglobal.html#qDebug">qDebug</a>(<span class="string">&quot;You didn't click on an item.&quot;</span>);
      }
  }

</pre>
<p><b>See also </b><a href="qgraphicsview.html#items">items</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@itemAt -->
<!-- $$$itemAt$$$itemAtintint -->
<h3 class="fn" id="itemAt-1"><a name="itemAt-1"></a><span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *QGraphicsView::<span class="name">itemAt</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>) const</h3>
<p>This is an overloaded function.</p>
<p>This function is provided for convenience. It's equivalent to calling <a href="qgraphicsview.html#itemAt">itemAt</a>(<a href="../qtcore/qpoint.html">QPoint</a>(<i>x</i>, <i>y</i>)).</p>
<!-- @@@itemAt -->
<!-- $$$items[overload1]$$$items -->
<h3 class="fn" id="items"><a name="items"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsView::<span class="name">items</span>() const</h3>
<p>Returns a list of all the items in the associated scene, in descending stacking order (i.e&#x2e;, the first item in the returned list is the uppermost item).</p>
<p><b>See also </b><a href="qgraphicsscene.html#items">QGraphicsScene::items</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsconstQPoint& -->
<h3 class="fn" id="items-1"><a name="items-1"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsView::<span class="name">items</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>pos</i>) const</h3>
<p>Returns a list of all the items at the position <i>pos</i> in the view. The items are listed in descending stacking order (i.e&#x2e;, the first item in the list is the uppermost item, and the last item is the lowermost item). <i>pos</i> is in viewport coordinates.</p>
<p>This function is most commonly called from within mouse event handlers in a subclass in <a href="qgraphicsview.html">QGraphicsView</a>. <i>pos</i> is in untransformed viewport coordinates, just like <a href="../qtgui/qmouseevent.html#pos">QMouseEvent::pos</a>().</p>
<pre class="cpp">

  <span class="type">void</span> CustomView<span class="operator">::</span>mousePressEvent(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> <span class="operator">*</span>event)
  {
      <a href="../qtcore/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;There are&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> items(event<span class="operator">-</span><span class="operator">&gt;</span>pos())<span class="operator">.</span>size()
               <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;items at position&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> mapToScene(event<span class="operator">-</span><span class="operator">&gt;</span>pos());
  }

</pre>
<p><b>See also </b><a href="qgraphicsscene.html#items">QGraphicsScene::items</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsintint -->
<h3 class="fn" id="items-2"><a name="items-2"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsView::<span class="name">items</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>) const</h3>
<p>This function is provided for convenience. It's equivalent to calling items(<a href="../qtcore/qpoint.html">QPoint</a>(<i>x</i>, <i>y</i>)).</p>
<!-- @@@items -->
<!-- $$$items$$$itemsconstQRect&Qt::ItemSelectionMode -->
<h3 class="fn" id="items-3"><a name="items-3"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsView::<span class="name">items</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rect</i>, <span class="type"><a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i> = Qt::IntersectsItemShape) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a list of all the items that, depending on <i>mode</i>, are either contained by or intersect with <i>rect</i>. <i>rect</i> is in viewport coordinates.</p>
<p>The default value for <i>mode</i> is <a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::IntersectsItemShape</a>; all items whose exact shape intersects with or is contained by <i>rect</i> are returned.</p>
<p>The items are sorted in descending stacking order (i.e&#x2e;, the first item in the returned list is the uppermost item).</p>
<p><b>See also </b><a href="qgraphicsview.html#itemAt">itemAt</a>(), <a href="qgraphicsview.html#items">items</a>(), <a href="qgraphicsview.html#mapToScene">mapToScene</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsintintintintQt::ItemSelectionMode -->
<h3 class="fn" id="items-4"><a name="items-4"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsView::<span class="name">items</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i>, <span class="type"><a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i> = Qt::IntersectsItemShape) const</h3>
<p>This convenience function is equivalent to calling items(<a href="../qtcore/qrectf.html">QRectF</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>), <i>mode</i>).</p>
<p>This function was introduced in  Qt 4.3.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsconstQPolygon&Qt::ItemSelectionMode -->
<h3 class="fn" id="items-5"><a name="items-5"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsView::<span class="name">items</span>(const <span class="type"><a href="../qtgui/qpolygon.html">QPolygon</a></span> &amp;<i>polygon</i>, <span class="type"><a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i> = Qt::IntersectsItemShape) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a list of all the items that, depending on <i>mode</i>, are either contained by or intersect with <i>polygon</i>. <i>polygon</i> is in viewport coordinates.</p>
<p>The default value for <i>mode</i> is <a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::IntersectsItemShape</a>; all items whose exact shape intersects with or is contained by <i>polygon</i> are returned.</p>
<p>The items are sorted by descending stacking order (i.e&#x2e;, the first item in the returned list is the uppermost item).</p>
<p><b>See also </b><a href="qgraphicsview.html#itemAt">itemAt</a>(), <a href="qgraphicsview.html#items">items</a>(), <a href="qgraphicsview.html#mapToScene">mapToScene</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsconstQPainterPath&Qt::ItemSelectionMode -->
<h3 class="fn" id="items-6"><a name="items-6"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsView::<span class="name">items</span>(const <span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>, <span class="type"><a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i> = Qt::IntersectsItemShape) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a list of all the items that, depending on <i>mode</i>, are either contained by or intersect with <i>path</i>. <i>path</i> is in viewport coordinates.</p>
<p>The default value for <i>mode</i> is <a href="../qtcore/qt.html#ItemSelectionMode-enum">Qt::IntersectsItemShape</a>; all items whose exact shape intersects with or is contained by <i>path</i> are returned.</p>
<p><b>See also </b><a href="qgraphicsview.html#itemAt">itemAt</a>(), <a href="qgraphicsview.html#items">items</a>(), <a href="qgraphicsview.html#mapToScene">mapToScene</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$keyPressEvent[overload1]$$$keyPressEventQKeyEvent* -->
<h3 class="fn" id="keyPressEvent"><a name="keyPressEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">keyPressEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>().</p>
<!-- @@@keyPressEvent -->
<!-- $$$keyReleaseEvent[overload1]$$$keyReleaseEventQKeyEvent* -->
<h3 class="fn" id="keyReleaseEvent"><a name="keyReleaseEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">keyReleaseEvent</span>(<span class="type"><a href="../qtgui/qkeyevent.html">QKeyEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#keyReleaseEvent">QWidget::keyReleaseEvent</a>().</p>
<!-- @@@keyReleaseEvent -->
<!-- $$$mapFromScene[overload1]$$$mapFromSceneconstQPointF& -->
<h3 class="fn" id="mapFromScene"><a name="mapFromScene"></a><span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> QGraphicsView::<span class="name">mapFromScene</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>) const</h3>
<p>Returns the scene coordinate <i>point</i> to viewport coordinates.</p>
<p><b>See also </b><a href="qgraphicsview.html#mapToScene">mapToScene</a>().</p>
<!-- @@@mapFromScene -->
<!-- $$$mapFromScene$$$mapFromSceneconstQRectF& -->
<h3 class="fn" id="mapFromScene-1"><a name="mapFromScene-1"></a><span class="type"><a href="../qtgui/qpolygon.html">QPolygon</a></span> QGraphicsView::<span class="name">mapFromScene</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i>) const</h3>
<p>Returns the scene rectangle <i>rect</i> to a viewport coordinate polygon.</p>
<p><b>See also </b><a href="qgraphicsview.html#mapToScene">mapToScene</a>().</p>
<!-- @@@mapFromScene -->
<!-- $$$mapFromScene$$$mapFromSceneconstQPolygonF& -->
<h3 class="fn" id="mapFromScene-2"><a name="mapFromScene-2"></a><span class="type"><a href="../qtgui/qpolygon.html">QPolygon</a></span> QGraphicsView::<span class="name">mapFromScene</span>(const <span class="type"><a href="../qtgui/qpolygonf.html">QPolygonF</a></span> &amp;<i>polygon</i>) const</h3>
<p>Returns the scene coordinate polygon <i>polygon</i> to a viewport coordinate polygon.</p>
<p><b>See also </b><a href="qgraphicsview.html#mapToScene">mapToScene</a>().</p>
<!-- @@@mapFromScene -->
<!-- $$$mapFromScene$$$mapFromSceneconstQPainterPath& -->
<h3 class="fn" id="mapFromScene-3"><a name="mapFromScene-3"></a><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsView::<span class="name">mapFromScene</span>(const <span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>) const</h3>
<p>Returns the scene coordinate painter path <i>path</i> to a viewport coordinate painter path.</p>
<p><b>See also </b><a href="qgraphicsview.html#mapToScene">mapToScene</a>().</p>
<!-- @@@mapFromScene -->
<!-- $$$mapFromScene$$$mapFromSceneqrealqreal -->
<h3 class="fn" id="mapFromScene-4"><a name="mapFromScene-4"></a><span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> QGraphicsView::<span class="name">mapFromScene</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>) const</h3>
<p>This function is provided for convenience. It's equivalent to calling <a href="qgraphicsview.html#mapFromScene">mapFromScene</a>(<a href="../qtcore/qpointf.html">QPointF</a>(<i>x</i>, <i>y</i>)).</p>
<!-- @@@mapFromScene -->
<!-- $$$mapFromScene$$$mapFromSceneqrealqrealqrealqreal -->
<h3 class="fn" id="mapFromScene-5"><a name="mapFromScene-5"></a><span class="type"><a href="../qtgui/qpolygon.html">QPolygon</a></span> QGraphicsView::<span class="name">mapFromScene</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>w</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>h</i>) const</h3>
<p>This function is provided for convenience. It's equivalent to calling <a href="qgraphicsview.html#mapFromScene">mapFromScene</a>(<a href="../qtcore/qrectf.html">QRectF</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>)).</p>
<!-- @@@mapFromScene -->
<!-- $$$mapToScene[overload1]$$$mapToSceneconstQPoint& -->
<h3 class="fn" id="mapToScene"><a name="mapToScene"></a><span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> QGraphicsView::<span class="name">mapToScene</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>) const</h3>
<p>Returns the viewport coordinate <i>point</i> mapped to scene coordinates.</p>
<p>Note: It can be useful to map the whole rectangle covered by the pixel at <i>point</i> instead of the point itself. To do this, you can call mapToScene(<a href="../qtcore/qrect.html">QRect</a>(<i>point</i>, <a href="../qtcore/qsize.html">QSize</a>(2, 2))).</p>
<p><b>See also </b><a href="qgraphicsview.html#mapFromScene">mapFromScene</a>().</p>
<!-- @@@mapToScene -->
<!-- $$$mapToScene$$$mapToSceneconstQRect& -->
<h3 class="fn" id="mapToScene-1"><a name="mapToScene-1"></a><span class="type"><a href="../qtgui/qpolygonf.html">QPolygonF</a></span> QGraphicsView::<span class="name">mapToScene</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rect</i>) const</h3>
<p>Returns the viewport rectangle <i>rect</i> mapped to a scene coordinate polygon.</p>
<p><b>See also </b><a href="qgraphicsview.html#mapFromScene">mapFromScene</a>().</p>
<!-- @@@mapToScene -->
<!-- $$$mapToScene$$$mapToSceneconstQPolygon& -->
<h3 class="fn" id="mapToScene-2"><a name="mapToScene-2"></a><span class="type"><a href="../qtgui/qpolygonf.html">QPolygonF</a></span> QGraphicsView::<span class="name">mapToScene</span>(const <span class="type"><a href="../qtgui/qpolygon.html">QPolygon</a></span> &amp;<i>polygon</i>) const</h3>
<p>Returns the viewport polygon <i>polygon</i> mapped to a scene coordinate polygon.</p>
<p><b>See also </b><a href="qgraphicsview.html#mapFromScene">mapFromScene</a>().</p>
<!-- @@@mapToScene -->
<!-- $$$mapToScene$$$mapToSceneconstQPainterPath& -->
<h3 class="fn" id="mapToScene-3"><a name="mapToScene-3"></a><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsView::<span class="name">mapToScene</span>(const <span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>) const</h3>
<p>Returns the viewport painter path <i>path</i> mapped to a scene coordinate painter path.</p>
<p><b>See also </b><a href="qgraphicsview.html#mapFromScene">mapFromScene</a>().</p>
<!-- @@@mapToScene -->
<!-- $$$mapToScene$$$mapToSceneintint -->
<h3 class="fn" id="mapToScene-4"><a name="mapToScene-4"></a><span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> QGraphicsView::<span class="name">mapToScene</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>) const</h3>
<p>This function is provided for convenience. It's equivalent to calling <a href="qgraphicsview.html#mapToScene">mapToScene</a>(<a href="../qtcore/qpoint.html">QPoint</a>(<i>x</i>, <i>y</i>)).</p>
<!-- @@@mapToScene -->
<!-- $$$mapToScene$$$mapToSceneintintintint -->
<h3 class="fn" id="mapToScene-5"><a name="mapToScene-5"></a><span class="type"><a href="../qtgui/qpolygonf.html">QPolygonF</a></span> QGraphicsView::<span class="name">mapToScene</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i>) const</h3>
<p>This function is provided for convenience. It's equivalent to calling <a href="qgraphicsview.html#mapToScene">mapToScene</a>(<a href="../qtcore/qrect.html">QRect</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>)).</p>
<!-- @@@mapToScene -->
<!-- $$$matrix[overload1]$$$matrix -->
<h3 class="fn" id="matrix"><a name="matrix"></a><span class="type"><a href="../qtgui/qmatrix.html">QMatrix</a></span> QGraphicsView::<span class="name">matrix</span>() const</h3>
<p>Returns the current transformation matrix for the view. If no current transformation is set, the identity matrix is returned.</p>
<p><b>See also </b><a href="qgraphicsview.html#setMatrix">setMatrix</a>(), <a href="qgraphicsview.html#transform">transform</a>(), <a href="qgraphicsview.html#rotate">rotate</a>(), <a href="qgraphicsview.html#scale">scale</a>(), <a href="qgraphicsview.html#shear">shear</a>(), and <a href="qgraphicsview.html#translate">translate</a>().</p>
<!-- @@@matrix -->
<!-- $$$mouseDoubleClickEvent[overload1]$$$mouseDoubleClickEventQMouseEvent* -->
<h3 class="fn" id="mouseDoubleClickEvent"><a name="mouseDoubleClickEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">mouseDoubleClickEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <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> QGraphicsView::<span class="name">mouseMoveEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <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> QGraphicsView::<span class="name">mousePressEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <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> QGraphicsView::<span class="name">mouseReleaseEvent</span>(<span class="type"><a href="../qtgui/qmouseevent.html">QMouseEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <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> QGraphicsView::<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>
<!-- @@@paintEvent -->
<!-- $$$render[overload1]$$$renderQPainter*constQRectF&constQRect&Qt::AspectRatioMode -->
<h3 class="fn" id="render"><a name="render"></a><span class="type">void</span> QGraphicsView::<span class="name">render</span>(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> *<i>painter</i>, const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>target</i> = QRectF(), const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>source</i> = QRect(), <span class="type"><a href="../qtcore/qt.html#AspectRatioMode-enum">Qt::AspectRatioMode</a></span> <i>aspectRatioMode</i> = Qt::KeepAspectRatio)</h3>
<p>Renders the <i>source</i> rect, which is in view coordinates, from the scene into <i>target</i>, which is in paint device coordinates, using <i>painter</i>. This function is useful for capturing the contents of the view onto a paint device, such as a <a href="../qtgui/qimage.html">QImage</a> (e.g&#x2e;, to take a screenshot), or for printing to QPrinter. For example:</p>
<pre class="cpp">

  <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene;
  scene<span class="operator">.</span>addItem(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>

  <span class="type"><a href="qgraphicsview.html#QGraphicsView">QGraphicsView</a></span> view(<span class="operator">&amp;</span>scene);
  view<span class="operator">.</span>show();
  <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>

  <span class="type">QPrinter</span> printer(<span class="type">QPrinter</span><span class="operator">::</span>HighResolution);
  printer<span class="operator">.</span>setPageSize(<span class="type">QPrinter</span><span class="operator">::</span>A4);
  <span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> painter(<span class="operator">&amp;</span>printer);

  <span class="comment">// print, fitting the viewport contents into a full page</span>
  view<span class="operator">.</span>render(<span class="operator">&amp;</span>painter);

  <span class="comment">// print the upper half of the viewport into the lower.</span>
  <span class="comment">// half of the page.</span>
  <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> viewport <span class="operator">=</span> view<span class="operator">.</span>viewport()<span class="operator">-</span><span class="operator">&gt;</span>rect();
  view<span class="operator">.</span>render(<span class="operator">&amp;</span>painter<span class="operator">,</span>
              <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span>(<span class="number">0</span><span class="operator">,</span> printer<span class="operator">.</span>height() <span class="operator">/</span> <span class="number">2</span><span class="operator">,</span>
                     printer<span class="operator">.</span>width()<span class="operator">,</span> printer<span class="operator">.</span>height() <span class="operator">/</span> <span class="number">2</span>)<span class="operator">,</span>
              viewport<span class="operator">.</span>adjusted(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="operator">-</span>viewport<span class="operator">.</span>height() <span class="operator">/</span> <span class="number">2</span>));

</pre>
<p>If <i>source</i> is a null rect, this function will use <a href="qabstractscrollarea.html#viewport">viewport</a>()-&gt;<a href="qwidget.html#rect-prop">rect</a>() to determine what to draw. If <i>target</i> is a null rect, the full dimensions of <i>painter</i>'s paint device (e.g&#x2e;, for a QPrinter, the page size) will be used.</p>
<p>The source rect contents will be transformed according to <i>aspectRatioMode</i> to fit into the target rect. By default, the aspect ratio is kept, and <i>source</i> is scaled to fit in <i>target</i>.</p>
<p><b>See also </b><a href="qgraphicsscene.html#render">QGraphicsScene::render</a>().</p>
<!-- @@@render -->
<!-- $$$resetCachedContent[overload1]$$$resetCachedContent -->
<h3 class="fn" id="resetCachedContent"><a name="resetCachedContent"></a><span class="type">void</span> QGraphicsView::<span class="name">resetCachedContent</span>()</h3>
<p>Resets any cached content. Calling this function will clear <a href="qgraphicsview.html">QGraphicsView</a>'s cache. If the current cache mode is <a href="qgraphicsview.html#CacheModeFlag-enum">CacheNone</a>, this function does nothing.</p>
<p>This function is called automatically for you when the <a href="qgraphicsview.html#backgroundBrush-prop">backgroundBrush</a> or <a href="qgraphicsscene.html#backgroundBrush-prop">QGraphicsScene::backgroundBrush</a> properties change; you only need to call this function if you have reimplemented <a href="qgraphicsscene.html#drawBackground">QGraphicsScene::drawBackground</a>() or <a href="qgraphicsview.html#drawBackground">QGraphicsView::drawBackground</a>() to draw a custom background, and need to trigger a full redraw.</p>
<p><b>See also </b><a href="qgraphicsview.html#cacheMode-prop">cacheMode</a>().</p>
<!-- @@@resetCachedContent -->
<!-- $$$resetMatrix[overload1]$$$resetMatrix -->
<h3 class="fn" id="resetMatrix"><a name="resetMatrix"></a><span class="type">void</span> QGraphicsView::<span class="name">resetMatrix</span>()</h3>
<p>Resets the view transformation matrix to the identity matrix.</p>
<p><b>See also </b><a href="qgraphicsview.html#resetTransform">resetTransform</a>().</p>
<!-- @@@resetMatrix -->
<!-- $$$resetTransform[overload1]$$$resetTransform -->
<h3 class="fn" id="resetTransform"><a name="resetTransform"></a><span class="type">void</span> QGraphicsView::<span class="name">resetTransform</span>()</h3>
<p>Resets the view transformation to the identity matrix.</p>
<p><b>See also </b><a href="qgraphicsview.html#transform">transform</a>() and <a href="qgraphicsview.html#setTransform">setTransform</a>().</p>
<!-- @@@resetTransform -->
<!-- $$$resizeEvent[overload1]$$$resizeEventQResizeEvent* -->
<h3 class="fn" id="resizeEvent"><a name="resizeEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<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>
<!-- @@@resizeEvent -->
<!-- $$$rotate[overload1]$$$rotateqreal -->
<h3 class="fn" id="rotate"><a name="rotate"></a><span class="type">void</span> QGraphicsView::<span class="name">rotate</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>angle</i>)</h3>
<p>Rotates the current view transformation <i>angle</i> degrees clockwise.</p>
<p><b>See also </b><a href="qgraphicsview.html#setTransform">setTransform</a>(), <a href="qgraphicsview.html#transform">transform</a>(), <a href="qgraphicsview.html#scale">scale</a>(), <a href="qgraphicsview.html#shear">shear</a>(), and <a href="qgraphicsview.html#translate">translate</a>().</p>
<!-- @@@rotate -->
<!-- $$$rubberBandChanged[overload1]$$$rubberBandChangedQRectQPointFQPointF -->
<h3 class="fn" id="rubberBandChanged"><a name="rubberBandChanged"></a><code>[signal] </code><span class="type">void</span> QGraphicsView::<span class="name">rubberBandChanged</span>(<span class="type"><a href="../qtcore/qrect.html">QRect</a></span> <i>rubberBandRect</i>, <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> <i>fromScenePoint</i>, <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> <i>toScenePoint</i>)</h3>
<p>This signal is emitted when the rubber band rect is changed. The viewport Rect is specified by <i>rubberBandRect</i>. The drag start position and drag end position are provided in scene points with <i>fromScenePoint</i> and <i>toScenePoint</i>.</p>
<p>When rubberband selection ends this signal will be emitted with null vales.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qgraphicsview.html#rubberBandRect">rubberBandRect</a>().</p>
<!-- @@@rubberBandChanged -->
<!-- $$$rubberBandRect[overload1]$$$rubberBandRect -->
<h3 class="fn" id="rubberBandRect"><a name="rubberBandRect"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QGraphicsView::<span class="name">rubberBandRect</span>() const</h3>
<p>This functions returns the current rubber band area (in viewport coordinates) if the user is currently doing an itemselection with rubber band. When the user is not using the rubber band this functions returns (a null) QRectF().</p>
<p>Notice that part of this <a href="../qtcore/qrect.html">QRect</a> can be outise the visual viewport. It can e.g contain negative values.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qgraphicsview.html#rubberBandSelectionMode-prop">rubberBandSelectionMode</a> and <a href="qgraphicsview.html#rubberBandChanged">rubberBandChanged</a>().</p>
<!-- @@@rubberBandRect -->
<!-- $$$scale[overload1]$$$scaleqrealqreal -->
<h3 class="fn" id="scale"><a name="scale"></a><span class="type">void</span> QGraphicsView::<span class="name">scale</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sy</i>)</h3>
<p>Scales the current view transformation by (<i>sx</i>, <i>sy</i>).</p>
<p><b>See also </b><a href="qgraphicsview.html#setTransform">setTransform</a>(), <a href="qgraphicsview.html#transform">transform</a>(), <a href="qgraphicsview.html#rotate">rotate</a>(), <a href="qgraphicsview.html#shear">shear</a>(), and <a href="qgraphicsview.html#translate">translate</a>().</p>
<!-- @@@scale -->
<!-- $$$scene[overload1]$$$scene -->
<h3 class="fn" id="scene"><a name="scene"></a><span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> *QGraphicsView::<span class="name">scene</span>() const</h3>
<p>Returns a pointer to the scene that is currently visualized in the view. If no scene is currently visualized, 0 is returned.</p>
<p><b>See also </b><a href="qgraphicsview.html#setScene">setScene</a>().</p>
<!-- @@@scene -->
<!-- $$$scrollContentsBy[overload1]$$$scrollContentsByintint -->
<h3 class="fn" id="scrollContentsBy"><a name="scrollContentsBy"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">scrollContentsBy</span>(<span class="type">int</span> <i>dx</i>, <span class="type">int</span> <i>dy</i>)</h3>
<p>Reimplemented from <a href="qabstractscrollarea.html#scrollContentsBy">QAbstractScrollArea::scrollContentsBy</a>().</p>
<!-- @@@scrollContentsBy -->
<!-- $$$setMatrix[overload1]$$$setMatrixconstQMatrix&bool -->
<h3 class="fn" id="setMatrix"><a name="setMatrix"></a><span class="type">void</span> QGraphicsView::<span class="name">setMatrix</span>(const <span class="type"><a href="../qtgui/qmatrix.html">QMatrix</a></span> &amp;<i>matrix</i>, <span class="type">bool</span> <i>combine</i> = false)</h3>
<p>Sets the view's current transformation matrix to <i>matrix</i>.</p>
<p>If <i>combine</i> is true, then <i>matrix</i> is combined with the current matrix; otherwise, <i>matrix</i> <i>replaces</i> the current matrix. <i>combine</i> is false by default.</p>
<p>The transformation matrix tranforms the scene into view coordinates. Using the default transformation, provided by the identity matrix, one pixel in the view represents one unit in the scene (e.g&#x2e;, a 10x10 rectangular item is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is applied, the scene will be drawn in 1:2 (e.g&#x2e;, a 10x10 rectangular item is then drawn using 20x20 pixels in the view).</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene;
  scene<span class="operator">.</span>addText(<span class="string">&quot;GraphicsView rotated clockwise&quot;</span>);

  <span class="type"><a href="qgraphicsview.html#QGraphicsView">QGraphicsView</a></span> view(<span class="operator">&amp;</span>scene);
  view<span class="operator">.</span>rotate(<span class="number">90</span>); <span class="comment">// the text is rendered with a 90 degree clockwise rotation</span>
  view<span class="operator">.</span>show();

</pre>
<p>To simplify interation with items using a transformed view, <a href="qgraphicsview.html">QGraphicsView</a> provides <a href="qwidget.html#mapTo">mapTo</a>... and <a href="qwidget.html#mapFrom">mapFrom</a>... functions that can translate between scene and view coordinates. For example, you can call <a href="qgraphicsview.html#mapToScene">mapToScene</a>() to map a view coordinate to a floating point scene coordinate, or <a href="qgraphicsview.html#mapFromScene">mapFromScene</a>() to map from floating point scene coordinates to view coordinates.</p>
<p><b>See also </b><a href="qgraphicsview.html#matrix">matrix</a>(), <a href="qgraphicsview.html#setTransform">setTransform</a>(), <a href="qgraphicsview.html#rotate">rotate</a>(), <a href="qgraphicsview.html#scale">scale</a>(), <a href="qgraphicsview.html#shear">shear</a>(), and <a href="qgraphicsview.html#translate">translate</a>().</p>
<!-- @@@setMatrix -->
<!-- $$$setOptimizationFlag[overload1]$$$setOptimizationFlagOptimizationFlagbool -->
<h3 class="fn" id="setOptimizationFlag"><a name="setOptimizationFlag"></a><span class="type">void</span> QGraphicsView::<span class="name">setOptimizationFlag</span>(<span class="type"><a href="qgraphicsview.html#OptimizationFlag-enum">OptimizationFlag</a></span> <i>flag</i>, <span class="type">bool</span> <i>enabled</i> = true)</h3>
<p>Enables <i>flag</i> if <i>enabled</i> is true; otherwise disables <i>flag</i>.</p>
<p><b>See also </b><a href="qgraphicsview.html#optimizationFlags-prop">optimizationFlags</a>.</p>
<!-- @@@setOptimizationFlag -->
<!-- $$$setRenderHint[overload1]$$$setRenderHintQPainter::RenderHintbool -->
<h3 class="fn" id="setRenderHint"><a name="setRenderHint"></a><span class="type">void</span> QGraphicsView::<span class="name">setRenderHint</span>(<span class="type"><a href="../qtgui/qpainter.html#RenderHint-enum">QPainter::RenderHint</a></span> <i>hint</i>, <span class="type">bool</span> <i>enabled</i> = true)</h3>
<p>If <i>enabled</i> is true, the render hint <i>hint</i> is enabled; otherwise it is disabled.</p>
<p><b>See also </b><a href="qgraphicsview.html#renderHints-prop">renderHints</a>.</p>
<!-- @@@setRenderHint -->
<!-- $$$setScene[overload1]$$$setSceneQGraphicsScene* -->
<h3 class="fn" id="setScene"><a name="setScene"></a><span class="type">void</span> QGraphicsView::<span class="name">setScene</span>(<span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> *<i>scene</i>)</h3>
<p>Sets the current scene to <i>scene</i>. If <i>scene</i> is already being viewed, this function does nothing.</p>
<p>When a scene is set on a view, the <a href="qgraphicsscene.html#changed">QGraphicsScene::changed</a>() signal is automatically connected to this view's <a href="qgraphicsview.html#updateScene">updateScene</a>() slot, and the view's scroll bars are adjusted to fit the size of the scene.</p>
<p>The view does not take ownership of <i>scene</i>.</p>
<p><b>See also </b><a href="qgraphicsview.html#scene">scene</a>().</p>
<!-- @@@setScene -->
<!-- $$$setTransform[overload1]$$$setTransformconstQTransform&bool -->
<h3 class="fn" id="setTransform"><a name="setTransform"></a><span class="type">void</span> QGraphicsView::<span class="name">setTransform</span>(const <span class="type"><a href="../qtgui/qtransform.html">QTransform</a></span> &amp;<i>matrix</i>, <span class="type">bool</span> <i>combine</i> = false)</h3>
<p>Sets the view's current transformation matrix to <i>matrix</i>.</p>
<p>If <i>combine</i> is true, then <i>matrix</i> is combined with the current matrix; otherwise, <i>matrix</i> <i>replaces</i> the current matrix. <i>combine</i> is false by default.</p>
<p>The transformation matrix tranforms the scene into view coordinates. Using the default transformation, provided by the identity matrix, one pixel in the view represents one unit in the scene (e.g&#x2e;, a 10x10 rectangular item is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is applied, the scene will be drawn in 1:2 (e.g&#x2e;, a 10x10 rectangular item is then drawn using 20x20 pixels in the view).</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene;
  scene<span class="operator">.</span>addText(<span class="string">&quot;GraphicsView rotated clockwise&quot;</span>);

  <span class="type"><a href="qgraphicsview.html#QGraphicsView">QGraphicsView</a></span> view(<span class="operator">&amp;</span>scene);
  view<span class="operator">.</span>rotate(<span class="number">90</span>); <span class="comment">// the text is rendered with a 90 degree clockwise rotation</span>
  view<span class="operator">.</span>show();

</pre>
<p>To simplify interation with items using a transformed view, <a href="qgraphicsview.html">QGraphicsView</a> provides <a href="qwidget.html#mapTo">mapTo</a>... and <a href="qwidget.html#mapFrom">mapFrom</a>... functions that can translate between scene and view coordinates. For example, you can call <a href="qgraphicsview.html#mapToScene">mapToScene</a>() to map a view coordiate to a floating point scene coordinate, or <a href="qgraphicsview.html#mapFromScene">mapFromScene</a>() to map from floating point scene coordinates to view coordinates.</p>
<p><b>See also </b><a href="qgraphicsview.html#transform">transform</a>(), <a href="qgraphicsview.html#rotate">rotate</a>(), <a href="qgraphicsview.html#scale">scale</a>(), <a href="qgraphicsview.html#shear">shear</a>(), and <a href="qgraphicsview.html#translate">translate</a>().</p>
<!-- @@@setTransform -->
<!-- $$$setupViewport[overload1]$$$setupViewportQWidget* -->
<h3 class="fn" id="setupViewport"><a name="setupViewport"></a><code>[virtual protected slot] </code><span class="type">void</span> QGraphicsView::<span class="name">setupViewport</span>(<span class="type"><a href="qwidget.html#QWidget">QWidget</a></span> *<i>widget</i>)</h3>
<p>Reimplemented from <a href="qabstractscrollarea.html#setupViewport">QAbstractScrollArea::setupViewport</a>().</p>
<p>This slot is called by <a href="qabstractscrollarea.html">QAbstractScrollArea</a> after <a href="qabstractscrollarea.html#setViewport">setViewport</a>() has been called. Reimplement this function in a subclass of <a href="qgraphicsview.html">QGraphicsView</a> to initialize the new viewport <i>widget</i> before it is used.</p>
<p><b>See also </b><a href="qabstractscrollarea.html#setViewport">setViewport</a>().</p>
<!-- @@@setupViewport -->
<!-- $$$shear[overload1]$$$shearqrealqreal -->
<h3 class="fn" id="shear"><a name="shear"></a><span class="type">void</span> QGraphicsView::<span class="name">shear</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sh</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sv</i>)</h3>
<p>Shears the current view transformation by (<i>sh</i>, <i>sv</i>).</p>
<p><b>See also </b><a href="qgraphicsview.html#setTransform">setTransform</a>(), <a href="qgraphicsview.html#transform">transform</a>(), <a href="qgraphicsview.html#rotate">rotate</a>(), <a href="qgraphicsview.html#scale">scale</a>(), and <a href="qgraphicsview.html#translate">translate</a>().</p>
<!-- @@@shear -->
<!-- $$$showEvent[overload1]$$$showEventQShowEvent* -->
<h3 class="fn" id="showEvent"><a name="showEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">showEvent</span>(<span class="type"><a href="../qtgui/qshowevent.html">QShowEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qwidget.html#showEvent">QWidget::showEvent</a>().</p>
<!-- @@@showEvent -->
<!-- $$$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> QGraphicsView::<span class="name">sizeHint</span>() const</h3>
<p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget::sizeHint</a>().</p>
<!-- @@@sizeHint -->
<!-- $$$transform[overload1]$$$transform -->
<h3 class="fn" id="transform"><a name="transform"></a><span class="type"><a href="../qtgui/qtransform.html">QTransform</a></span> QGraphicsView::<span class="name">transform</span>() const</h3>
<p>Returns the current transformation matrix for the view. If no current transformation is set, the identity matrix is returned.</p>
<p><b>See also </b><a href="qgraphicsview.html#setTransform">setTransform</a>(), <a href="qgraphicsview.html#rotate">rotate</a>(), <a href="qgraphicsview.html#scale">scale</a>(), <a href="qgraphicsview.html#shear">shear</a>(), and <a href="qgraphicsview.html#translate">translate</a>().</p>
<!-- @@@transform -->
<!-- $$$translate[overload1]$$$translateqrealqreal -->
<h3 class="fn" id="translate"><a name="translate"></a><span class="type">void</span> QGraphicsView::<span class="name">translate</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dy</i>)</h3>
<p>Translates the current view transformation by (<i>dx</i>, <i>dy</i>).</p>
<p><b>See also </b><a href="qgraphicsview.html#setTransform">setTransform</a>(), <a href="qgraphicsview.html#transform">transform</a>(), <a href="qgraphicsview.html#rotate">rotate</a>(), and <a href="qgraphicsview.html#shear">shear</a>().</p>
<!-- @@@translate -->
<!-- $$$updateScene[overload1]$$$updateSceneconstQList<QRectF>& -->
<h3 class="fn" id="updateScene"><a name="updateScene"></a><code>[slot] </code><span class="type">void</span> QGraphicsView::<span class="name">updateScene</span>(const <span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span>&gt; &amp;<i>rects</i>)</h3>
<p>Schedules an update of the scene rectangles <i>rects</i>.</p>
<p><b>See also </b><a href="qgraphicsscene.html#changed">QGraphicsScene::changed</a>().</p>
<!-- @@@updateScene -->
<!-- $$$updateSceneRect[overload1]$$$updateSceneRectconstQRectF& -->
<h3 class="fn" id="updateSceneRect"><a name="updateSceneRect"></a><code>[slot] </code><span class="type">void</span> QGraphicsView::<span class="name">updateSceneRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i>)</h3>
<p>Notifies <a href="qgraphicsview.html">QGraphicsView</a> that the scene's scene rect has changed. <i>rect</i> is the new scene rect. If the view already has an explicitly set scene rect, this function does nothing.</p>
<p><b>See also </b><a href="qgraphicsview.html#sceneRect-prop">sceneRect</a> and <a href="qgraphicsscene.html#sceneRectChanged">QGraphicsScene::sceneRectChanged</a>().</p>
<!-- @@@updateSceneRect -->
<!-- $$$viewportEvent[overload1]$$$viewportEventQEvent* -->
<h3 class="fn" id="viewportEvent"><a name="viewportEvent"></a><code>[virtual protected] </code><span class="type">bool</span> QGraphicsView::<span class="name">viewportEvent</span>(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <a href="qabstractscrollarea.html#viewportEvent">QAbstractScrollArea::viewportEvent</a>().</p>
<!-- @@@viewportEvent -->
<!-- $$$viewportTransform[overload1]$$$viewportTransform -->
<h3 class="fn" id="viewportTransform"><a name="viewportTransform"></a><span class="type"><a href="../qtgui/qtransform.html">QTransform</a></span> QGraphicsView::<span class="name">viewportTransform</span>() const</h3>
<p>Returns a matrix that maps scene coordinates to viewport coordinates.</p>
<p><b>See also </b><a href="qgraphicsview.html#mapToScene">mapToScene</a>() and <a href="qgraphicsview.html#mapFromScene">mapFromScene</a>().</p>
<!-- @@@viewportTransform -->
<!-- $$$wheelEvent[overload1]$$$wheelEventQWheelEvent* -->
<h3 class="fn" id="wheelEvent"><a name="wheelEvent"></a><code>[virtual protected] </code><span class="type">void</span> QGraphicsView::<span class="name">wheelEvent</span>(<span class="type"><a href="../qtgui/qwheelevent.html">QWheelEvent</a></span> *<i>event</i>)</h3>
<p>Reimplemented from <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>