<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qchartview.cpp --> <title>QChartView Class | Qt Charts 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="qtcharts-index.html">Qt Charts</a></td><td ><a href="qt-charts-module.html">C++ Classes</a></td><td >QChartView</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="#public-functions">Public Functions</a></li> <li class="level1"><a href="#protected-functions">Protected Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QChartView Class</h1> <!-- $$$QChartView-brief --> <p>The <a href="qchartview.html">QChartView</a> is a standalone widget that can display charts. <a href="#details">More...</a></p> <!-- @@@QChartView --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QChartView></span> </td></tr></table></div><ul> <li><a href="qchartview-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2 id="public-types">Public Types</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#RubberBand-enum">RubberBand</a></b> { NoRubberBand, VerticalRubberBand, HorizontalRubberBand, RectangleRubberBand }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#RubberBand-enum">RubberBands</a></b></td></tr> </table></div> <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="qchartview.html#QChartView">QChartView</a></b>(QWidget *<i>parent</i> = Q_NULLPTR)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#QChartView-1">QChartView</a></b>(QChart *<i>chart</i>, QWidget *<i>parent</i> = Q_NULLPTR)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#dtor.QChartView">~QChartView</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QChart *</td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#chart">chart</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> RubberBands </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#rubberBand">rubberBand</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#setChart">setChart</a></b>(QChart *<i>chart</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#setRubberBand">setRubberBand</a></b>(const RubberBands &<i>rubberBand</i>)</td></tr> </table></div> <a name="protected-functions"></a> <h2 id="protected-functions">Protected Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#mouseMoveEvent">mouseMoveEvent</a></b>(QMouseEvent *<i>event</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#mousePressEvent">mousePressEvent</a></b>(QMouseEvent *<i>event</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#mouseReleaseEvent">mouseReleaseEvent</a></b>(QMouseEvent *<i>event</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qchartview.html#resizeEvent">resizeEvent</a></b>(QResizeEvent *<i>event</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QChartView-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qchartview.html">QChartView</a> is a standalone widget that can display charts.</p> <p>A chart view does not require a QGraphicsScene object to work. To display a chart in an existing QGraphicsScene, the <a href="qchart.html">QChart</a> or <a href="qpolarchart.html">QPolarChart</a> class should be used instead.</p> </div> <p><b>See also </b><a href="qchart.html">QChart</a> and <a href="qpolarchart.html">QPolarChart</a>.</p> <!-- @@@QChartView --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$RubberBand$$$NoRubberBand$$$VerticalRubberBand$$$HorizontalRubberBand$$$RectangleRubberBand --> <h3 class="flags" id="RubberBand-enum"><a name="RubberBand-enum"></a>enum QChartView::<span class="name">RubberBand</span><br/>flags QChartView::<span class="name">RubberBands</span></h3> <p>This enum describes the different types of rubber band effects that can be applied to the rectangular zooming area.</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>QChartView::NoRubberBand</code></td><td class="topAlign tblval"><code>0x0</code></td><td class="topAlign">No zooming area is specified, and therefore zooming is not enabled.</td></tr> <tr><td class="topAlign"><code>QChartView::VerticalRubberBand</code></td><td class="topAlign tblval"><code>0x1</code></td><td class="topAlign">The rubber band is locked to the size of the chart horizontally and can be pulled vertically to specify the zooming area.</td></tr> <tr><td class="topAlign"><code>QChartView::HorizontalRubberBand</code></td><td class="topAlign tblval"><code>0x2</code></td><td class="topAlign">The rubber band is locked to the size of the chart vertically and can be pulled horizontally to specify the zooming area.</td></tr> <tr><td class="topAlign"><code>QChartView::RectangleRubberBand</code></td><td class="topAlign tblval"><code>0x3</code></td><td class="topAlign">The rubber band is fixed to the point that was clicked and can be pulled both vertically and horizontally.</td></tr> </table></div> <p>The RubberBands type is a typedef for <a href="">QFlags</a><RubberBand>. It stores an OR combination of RubberBand values.</p> <!-- @@@RubberBand --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QChartView[overload1]$$$QChartViewQWidget* --> <h3 class="fn" id="QChartView"><a name="QChartView"></a>QChartView::<span class="name">QChartView</span>(<span class="type">QWidget</span> *<i>parent</i> = Q_NULLPTR)</h3> <p>Constructs a chart view object with the parent <i>parent</i>.</p> <!-- @@@QChartView --> <!-- $$$QChartView$$$QChartViewQChart*QWidget* --> <h3 class="fn" id="QChartView-1"><a name="QChartView-1"></a>QChartView::<span class="name">QChartView</span>(<span class="type"><a href="qchart.html">QChart</a></span> *<i>chart</i>, <span class="type">QWidget</span> *<i>parent</i> = Q_NULLPTR)</h3> <p>Constructs a chart view object with the parent <i>parent</i> to display the chart <i>chart</i>. The ownership of the chart is passed to the chart view.</p> <!-- @@@QChartView --> <!-- $$$~QChartView[overload1]$$$~QChartView --> <h3 class="fn" id="dtor.QChartView"><a name="dtor.QChartView"></a>QChartView::<span class="name">~QChartView</span>()</h3> <p>Deletes the chart view object and the associated chart.</p> <!-- @@@~QChartView --> <!-- $$$chart[overload1]$$$chart --> <h3 class="fn" id="chart"><a name="chart"></a><span class="type"><a href="qchart.html">QChart</a></span> *QChartView::<span class="name">chart</span>() const</h3> <p>Returns the pointer to the associated chart.</p> <p><b>See also </b><a href="qchartview.html#setChart">setChart</a>().</p> <!-- @@@chart --> <!-- $$$mouseMoveEvent[overload1]$$$mouseMoveEventQMouseEvent* --> <h3 class="fn" id="mouseMoveEvent"><a name="mouseMoveEvent"></a><code>[protected] </code><span class="type">void</span> QChartView::<span class="name">mouseMoveEvent</span>(<span class="type">QMouseEvent</span> *<i>event</i>)</h3> <p>If the rubber band rectangle is displayed in the press event specified by <i>event</i>, the event data is used to update the rubber band geometry. Otherwise, the default QGraphicsView::mouseMoveEvent() implementation is called.</p> <!-- @@@mouseMoveEvent --> <!-- $$$mousePressEvent[overload1]$$$mousePressEventQMouseEvent* --> <h3 class="fn" id="mousePressEvent"><a name="mousePressEvent"></a><code>[protected] </code><span class="type">void</span> QChartView::<span class="name">mousePressEvent</span>(<span class="type">QMouseEvent</span> *<i>event</i>)</h3> <p>If the left mouse button is pressed and the rubber band is enabled, the event <i>event</i> is accepted and the rubber band is displayed on the screen. This enables the user to select the zoom area.</p> <p>If some other mouse button is pressed or the rubber band is disabled, the event is passed to QGraphicsView::mousePressEvent().</p> <!-- @@@mousePressEvent --> <!-- $$$mouseReleaseEvent[overload1]$$$mouseReleaseEventQMouseEvent* --> <h3 class="fn" id="mouseReleaseEvent"><a name="mouseReleaseEvent"></a><code>[protected] </code><span class="type">void</span> QChartView::<span class="name">mouseReleaseEvent</span>(<span class="type">QMouseEvent</span> *<i>event</i>)</h3> <p>If the left mouse button is released and the rubber band is enabled, the event <i>event</i> is accepted and the view is zoomed into the rectangle specified by the rubber band. If releasing the right mouse button triggered the event, the view is zoomed out.</p> <!-- @@@mouseReleaseEvent --> <!-- $$$resizeEvent[overload1]$$$resizeEventQResizeEvent* --> <h3 class="fn" id="resizeEvent"><a name="resizeEvent"></a><code>[protected] </code><span class="type">void</span> QChartView::<span class="name">resizeEvent</span>(<span class="type">QResizeEvent</span> *<i>event</i>)</h3> <p>Resizes and updates the chart area using the data specified by <i>event</i>.</p> <!-- @@@resizeEvent --> <!-- $$$rubberBand[overload1]$$$rubberBand --> <h3 class="fn" id="rubberBand"><a name="rubberBand"></a><span class="type"><a href="qchartview.html#RubberBand-enum">RubberBands</a></span> QChartView::<span class="name">rubberBand</span>() const</h3> <p>Returns the rubber band flags that are currently being used by the chart view.</p> <p><b>See also </b><a href="qchartview.html#setRubberBand">setRubberBand</a>().</p> <!-- @@@rubberBand --> <!-- $$$setChart[overload1]$$$setChartQChart* --> <h3 class="fn" id="setChart"><a name="setChart"></a><span class="type">void</span> QChartView::<span class="name">setChart</span>(<span class="type"><a href="qchart.html">QChart</a></span> *<i>chart</i>)</h3> <p>Sets the current chart to <i>chart</i>. The ownership of the new chart is passed to the chart view and the ownership of the previous chart is released.</p> <p>To avoid memory leaks, the previous chart must be deleted.</p> <p><b>See also </b><a href="qchartview.html#chart">chart</a>().</p> <!-- @@@setChart --> <!-- $$$setRubberBand[overload1]$$$setRubberBandconstRubberBands& --> <h3 class="fn" id="setRubberBand"><a name="setRubberBand"></a><span class="type">void</span> QChartView::<span class="name">setRubberBand</span>(const <span class="type"><a href="qchartview.html#RubberBand-enum">RubberBands</a></span> &<i>rubberBand</i>)</h3> <p>Sets the rubber band flags to <i>rubberBand</i>. The selected flags determine the way zooming is performed.</p> <p><b>Note: </b>Rubber band zooming is not supported for polar charts.</p><p><b>See also </b><a href="qchartview.html#rubberBand">rubberBand</a>().</p> <!-- @@@setRubberBand --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</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>