QChartView Class
Standalone charting widget. More...
Header: | #include <QChartView> |
Inherits: | QGraphicsView |
Public Types
enum | RubberBand { NoRubberBand, VerticalRubberBand, HorizontalRubberBand, RectangleRubberBand } |
flags | RubberBands |
Public Functions
QChartView(QWidget *parent = Q_NULLPTR) | |
QChartView(QChart *chart, QWidget *parent = Q_NULLPTR) | |
~QChartView() | |
QChart * | chart() const |
RubberBands | rubberBand() const |
void | setChart(QChart *chart) |
void | setRubberBand(const RubberBands &rubberBand) |
- 78 public functions inherited from QGraphicsView
- 20 public functions inherited from QAbstractScrollArea
- 14 public functions inherited from QFrame
- 211 public functions inherited from QWidget
- 31 public functions inherited from QObject
- 14 public functions inherited from QPaintDevice
Reimplemented Protected Functions
virtual void | mouseMoveEvent(QMouseEvent *event) |
virtual void | mousePressEvent(QMouseEvent *event) |
virtual void | mouseReleaseEvent(QMouseEvent *event) |
virtual void | resizeEvent(QResizeEvent *event) |
- 24 protected functions inherited from QGraphicsView
- 20 protected functions inherited from QAbstractScrollArea
- 4 protected functions inherited from QFrame
- 35 protected functions inherited from QWidget
- 9 protected functions inherited from QObject
- 1 protected function inherited from QPaintDevice
Additional Inherited Members
- 13 properties inherited from QGraphicsView
- 3 properties inherited from QAbstractScrollArea
- 6 properties inherited from QFrame
- 58 properties inherited from QWidget
- 1 property inherited from QObject
- 3 public slots inherited from QGraphicsView
- 19 public slots inherited from QWidget
- 1 public slot inherited from QObject
- 1 signal inherited from QGraphicsView
- 3 signals inherited from QWidget
- 2 signals inherited from QObject
- 5 static public members inherited from QWidget
- 11 static public members inherited from QObject
- 24 protected functions inherited from QGraphicsView
- 20 protected functions inherited from QAbstractScrollArea
- 4 protected functions inherited from QFrame
- 35 protected functions inherited from QWidget
- 9 protected functions inherited from QObject
- 1 protected function inherited from QPaintDevice
- 1 protected slot inherited from QGraphicsView
- 1 protected slot inherited from QWidget
Detailed Description
Standalone charting widget.
QChartView is a standalone widget that can display charts. It does not require separate QGraphicsScene to work. If you want to display a chart in your existing QGraphicsScene, you need to use the QChart (or QPolarChart) class instead.
See also QChart and QPolarChart.
Member Type Documentation
enum QChartView::RubberBand
flags QChartView::RubberBands
This enum describes the different types of rubber bands that can be used for zoom rect selection
Constant | Value |
---|---|
QChartView::NoRubberBand | 0x0 |
QChartView::VerticalRubberBand | 0x1 |
QChartView::HorizontalRubberBand | 0x2 |
QChartView::RectangleRubberBand | 0x3 |
The RubberBands type is a typedef for QFlags<RubberBand>. It stores an OR combination of RubberBand values.
Member Function Documentation
QChartView::QChartView(QWidget *parent = Q_NULLPTR)
Constructs a chartView object with parent parent.
QChartView::QChartView(QChart *chart, QWidget *parent = Q_NULLPTR)
Constructs a chartview object with parent parent to display a chart. Ownership of the chart is passed to chartview.
QChartView::~QChartView()
Destroys the chartview object and the associated chart.
QChart *QChartView::chart() const
Returns the pointer to the associated chart.
See also setChart().
[virtual protected]
void QChartView::mouseMoveEvent(QMouseEvent *event)
Reimplemented from QWidget::mouseMoveEvent().
If the rubber band rectange has been displayed in pressEvent then event data is used to update the rubber band geometry. Otherwise the default QGraphicsView::mouseMoveEvent implementation is called.
[virtual protected]
void QChartView::mousePressEvent(QMouseEvent *event)
Reimplemented from QWidget::mousePressEvent().
If Left mouse button is pressed and the rubber band is enabled the event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area. If different mouse button is pressed and/or the rubber band is disabled then the event is passed to QGraphicsView::mousePressEvent() implementation.
[virtual protected]
void QChartView::mouseReleaseEvent(QMouseEvent *event)
Reimplemented from QWidget::mouseReleaseEvent().
If left mouse button is released and the rubber band is enabled then event is accepted and the view is zoomed into the rect specified by the rubber band. If it is a right mouse button event then the view is zoomed out.
[virtual protected]
void QChartView::resizeEvent(QResizeEvent *event)
Reimplemented from QWidget::resizeEvent().
Resizes and updates the chart area using the event data
RubberBands QChartView::rubberBand() const
Returns the rubber band flags that are currently being used by the widget.
See also setRubberBand().
void QChartView::setChart(QChart *chart)
Sets the current chart to chart. Ownership of the new chart is passed to chartview and ownership of the previous chart is released.
To avoid memory leaks users need to make sure the previous chart is deleted.
See also chart().
void QChartView::setRubberBand(const RubberBands &rubberBand)
Sets the rubber band flags to rubberBand. Selected flags determine the way zooming is performed.
Note: Rubber band zooming is not supported for polar charts.
See also rubberBand().
© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.