QChartView是一个可以显示图表的独立窗口部件。

头文件:#include <QChartView>

继承:QGraphicsView

公开类型:
enum 
RubberBand { NoRubberBand, VerticalRubberBand, HorizontalRubberBand, RectangleRubberBand }

该枚举描述了可以应用于矩形缩放区域的不同类型的橡皮筋效果。

常量 描述

QChartView::NoRubberBand

0x0

未指定缩放区域,因此无法启用缩放。

QChartView::VerticalRubberBand

0x1

橡皮筋水平锁定在图表的大小,可以垂直拉动以指定缩放区域。

QChartView::HorizontalRubberBand

0x2

橡皮筋会垂直锁定到图表大小,并且可以水平拉动以指定缩放区域。

QChartView::RectangleRubberBand

0x3 橡皮筋固定在被点击的位置,可以垂直和水平拉动。

RubberBands类型是QFlags <RubberBand>的typedef。 它存储RubberBand值的OR组合。

公有函数:

QChartView(QChart *chart, QWidget *parent = nullptr)

QChartView(QWidget *parent = nullptr)
virtual  ~QChartView()
QChart  *chart() const
QChartView::RubberBands  rubberBand() const
void  setChart(QChart *chart)
void  setRubberBand(const QChartView::RubberBands &rubberBand)
重新实现保护功能:

virtual void mouseMoveEvent(QMouseEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
virtual void mouseReleaseEvent(QMouseEvent *event) override
virtual void resizeEvent(QResizeEvent *event) override
相关非会员:

typedef QObjectList
QList<T> qFindChildren(const QObject *obj, const QRegExp &regExp)
T qobject_cast(QObject *object)
T qobject_cast(const QObject *object)
宏:

QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
QWIDGETSIZE_MAX
Q_CLASSINFO(Name, Value)
Q_DISABLE_COPY(Class)
Q_DISABLE_COPY_MOVE(Class)
Q_DISABLE_MOVE(Class)
Q_EMIT
Q_ENUM(...)
Q_ENUM_NS(...)
Q_FLAG(...)
Q_FLAG_NS(...)
Q_GADGET
Q_INTERFACES(...)
Q_INVOKABLE
Q_NAMESPACE
Q_OBJECT
Q_PROPERTY(...)
Q_REVISION
Q_SET_OBJECT_NAME(Object)
Q_SIGNAL
Q_SIGNALS
Q_SLOT
Q_SLOTS
详细描述:

图表视图不需要QGraphicsScene对象即可工作。 要在现有QGraphicsScene中显示图表,应改用QChart或QPolarChart类。

成员函数说明:

QChartView::QChartView(QChart *chart, QWidget *parent = 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(QWidget *parent = nullptr)

Constructs a chart view object with the parent parent.

构造一个chartview实例使用父类

[virtual] QChartView::~QChartView()

Deletes the chart view object and the associated chart.

删除一个chartview以及相关的图表

QChart *QChartView::chart() const

Returns the pointer to the associated chart.

See also setChart().

返回相关的图表指针

[override virtual protected] void QChartView::mouseMoveEvent(QMouseEvent *event)

Reimplements: QGraphicsView::mouseMoveEvent(QMouseEvent *event).

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.

如果橡皮筋矩形显示在事件指定的新闻事件中,则事件数据将用于更新橡皮筋的几何形状。 否则,将调用默认的QGraphicsView :: mouseMoveEvent()实现。

[override virtual protected] void QChartView::mousePressEvent(QMouseEvent *event)

Reimplements: QGraphicsView::mousePressEvent(QMouseEvent *event).

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().

如果按下鼠标左键并启用了橡皮筋,则接受事件事件,并且橡皮筋显示在屏幕上。 这使用户能够选择缩放区域。

如果按下了其他鼠标按钮或禁用了橡皮筋,则事件将传递到QGraphicsView :: mousePressEvent()。

[override virtual protected] void QChartView::mouseReleaseEvent(QMouseEvent *event)

Reimplements: QGraphicsView::mouseReleaseEvent(QMouseEvent *event).

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.

如果释放鼠标左键并启用橡皮筋,则将接受事件事件,并且视图将放大到橡皮筋指定的矩形。 如果释放鼠标右键触发了事件,则视图将缩小。

[override virtual protected] void QChartView::resizeEvent(QResizeEvent *event)

Reimplements: QGraphicsView::resizeEvent(QResizeEvent *event).

Resizes and updates the chart area using the data specified by event.

使用事件指定的数据调整和更新图表区域。

QChartView::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 QChartView::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.

将橡皮筋标志设置为rubberBand。 所选标志确定执行缩放的方式。

注意:极坐标图不支持橡皮筋缩放。

See also rubberBand().

Qt QChartView class相关推荐

  1. QT QChartView 鼠标随动 十字线 缩放 平移 拖动

    QChart添加跟随鼠标的十字线_x县豆瓣酱的博客-CSDN博客_qchart鼠标跟踪线 最近在做这么一个东西,需要十字线.我参考自上面的博主的内容,但是他没写全.很多人不知道这个QGraphicsL ...

  2. QT QChartView显示坐标值

    实现方法有两种: 1. 重写QChartView类 .h文件 #ifndef QCHARTVIEW_T_H #define QCHARTVIEW_T_H#include <QObject> ...

  3. Qt Charts使用(重写QChartView,实现一些自定义功能)

    文章目录 1.charts简单使用 2.重写QChartView 1.charts简单使用 QLineSeries* m_pSeries = new QLineSeries();QFile file( ...

  4. Qt for python QChartView鼠标滚动放大缩小

    文章目录 前言 基于 QChart 缩放的几种方式 使用QChartView来缩放 使用QChart来平移和缩放 使用QValueAxis或者QDateTimeAxis来平移和缩放 Qt曲线图表模块Q ...

  5. QT绘制饼状图QChartView

    QT绘制饼状图QChartView 介绍 Demo 介绍 首先要在pro里加上 QT += charts 然后添加以下 #include <QtCharts> using namespac ...

  6. qt获取combobox的值_Qt官方示例嵌套甜甜圈

    ❝ 本示例演示如何使用QPieSeries API创建嵌套的甜甜圈图. ❞ 创建嵌套甜甜圈图   先创建一个QChartView实例并启用抗锯齿.然后从QChartView实例获得一个QChart对象 ...

  7. Qt Charts基本组成

    简述 Qt Charts API 构建在 Qt Graphics View 框架之上,可以使用 QChart 类将图表显示为 QGraphicsWidget.但还有一个方便的类 - QChartVie ...

  8. qt可视化数据展板_Qt 2D数据可视化之QCharts

    欢迎关注公众号,获得更多其他信息.如果对你有帮助,可以点个赞,让它可以帮助到更多的同志~ 公众号: Pou光明 Qt Charts 在Qt4时代就有了,不过一直以来是商业许可的.QCharts可以在社 ...

  9. QT绘制嵌套的圆饼状图

    QT绘制嵌套的圆饼状图 项目简介 项目技术 项目展示 主要源码片段解析 获取完整项目源码传送门 项目简介 使用QPieSeries API创建嵌套的甜甜圈图. 项目技术 qt5.12,qt chart ...

  10. 设置qt的QChart曲线背景色透明

    由于业务需求,需要设置曲线的背景色透明,仅仅用下述代码不行: m_pChart->setBackgroundVisible(false); 除了上述代码外,还需设置主窗体透明和曲线视图为透明: ...

最新文章

  1. Android学习日记(1)
  2. php和python对比-通过PHP与Python代码对比浅析语法差异
  3. 透过 OKR 进行项目过程管理
  4. vivado环境下用Verilog语言实现编码器
  5. 计算机如何驱动无线网络,win7如何安装无线网卡驱动 安装无线网卡驱动的方法...
  6. Android 系统性能优化(81)---Android后台优化系列-background optimization-初识低耗电模式
  7. R 指定安装镜像的方法
  8. 微信七年,终于实现一键切换账号功能了!
  9. 用FileOutputStream将内容写入到文本
  10. jquery扩展 $.fn
  11. 开课吧9.9学python课_python 自动化运维 零基础入门 课程
  12. Windows 10 Java安装教程
  13. ABAQUS单位统一
  14. 对于利用blender获取谷歌地图3D模型的补充
  15. Ripple相关资源汇总
  16. 个人作业 Alpha项目测试
  17. 比特大陆“政变”72小时
  18. 苹果10.13.6,开机的时候经常会显示 禁止符号
  19. 获取指定日期所在月的最后一个工作日
  20. VMware虚拟机安装Linux教程

热门文章

  1. 前端智能化实践——可微编程
  2. 【python绘图】seaborn(sns)的主题风格
  3. Spark列级血缘(字段级别血缘)开发与实现
  4. shopxp商城系统对接个人支付宝免签h5支付
  5. Mikrotik路由器(有线)快速设置教程
  6. android手机碎片管理,android手机需要进行磁盘碎片整理么
  7. 同款蓝牙耳机为什么会串联_为什么蓝牙耳机不能两个同时使用
  8. 《费曼学习法》读书笔记
  9. php mcrypt blowfish,php加密算法blowfish
  10. android 适配俄语添加,【技术贴】怎么在手机上添加俄语输入法?,怎样在电脑上打俄语重音?...