QChartView Class
The QChartView is a standalone widget that can display charts. 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
- 214 public functions inherited from QWidget
- 32 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
- 59 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
The QChartView is a standalone widget that can display charts.
A chart view does not require a QGraphicsScene object to work. To display a chart in an existing QGraphicsScene, the QChart or QPolarChart class should be used instead.
See also QChart and QPolarChart.
Member Type Documentation
enum QChartView::RubberBand
flags QChartView::RubberBands
This enum describes the different types of rubber band effects that can be applied to the rectangular zooming area.
Constant | Value | Description |
---|---|---|
QChartView::NoRubberBand | 0x0 | No zooming area is specified, and therefore zooming is not enabled. |
QChartView::VerticalRubberBand | 0x1 | The rubber band is locked to the size of the chart horizontally and can be pulled vertically to specify the zooming area. |
QChartView::HorizontalRubberBand | 0x2 | The rubber band is locked to the size of the chart vertically and can be pulled horizontally to specify the zooming area. |
QChartView::RectangleRubberBand | 0x3 | The rubber band is fixed to the point that was clicked and can be pulled both vertically and horizontally. |
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 chart view object with the parent parent.
QChartView::QChartView(QChart *chart, QWidget *parent = Q_NULLPTR)
Constructs a chart view object with the parent parent to display the chart chart. The ownership of the chart is passed to the chart view.
QChartView::~QChartView()
Deletes the chart view 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 rectangle is displayed in the press event specified by event, the 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 the left mouse button is pressed and the rubber band is enabled, the event event is accepted and the rubber band is displayed on the screen. This enables the user to select the zoom area.
If some other mouse button is pressed or the rubber band is disabled, the event is passed to QGraphicsView::mousePressEvent().
[virtual protected]
void QChartView::mouseReleaseEvent(QMouseEvent *event)
Reimplemented from QWidget::mouseReleaseEvent().
If the left mouse button is released and the rubber band is enabled, the event event 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.
[virtual protected]
void QChartView::resizeEvent(QResizeEvent *event)
Reimplemented from QWidget::resizeEvent().
Resizes and updates the chart area using the data specified by event.
RubberBands QChartView::rubberBand() const
Returns the rubber band flags that are currently being used by the chart view.
See also setRubberBand().
void QChartView::setChart(QChart *chart)
Sets the current chart to chart. The ownership of the new chart is passed to the chart view and the ownership of the previous chart is released.
To avoid memory leaks, the previous chart must be deleted.
See also chart().
void QChartView::setRubberBand(const RubberBands &rubberBand)
Sets the rubber band flags to rubberBand. The selected flags determine the way zooming is performed.
Note: Rubber band zooming is not supported for polar charts.
See also rubberBand().
© 2018 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.