qtvs添加qchart,如何使用Qt Designer在窗体中插入QChartView?

本文介绍了如何在Qt Designer中添加QChartView。方法一为提升(Promote)QGraphicsView为QChartView,通过在.pro文件中添加QT += charts,然后右键选择Promote to...,设置好Promoted Class Name和Header file。另一种方法是编译QtChart插件,下载相关文件后执行qmake、make和sudo make install,以便在Qt Designer中使用QtCharts::QChartView。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I want to add QChart to the form. But I can't find it in the Widget Box. So I created it in the code. How can I insert it in QWidget or QFrame or something else?

I want to set area of that widget in QtDesigner.

解决方案

Option 1: Promoted

I suppose you mean inserting a QChartView, because QChartView inherits from QGraphicsView, this would be a good option, for this we do the following:

first add QT += charts in the .pro

place the QGraphicsView to the design.

Right click on the QGraphicsView and select Promote to...

When doing the above, a menu appears, in the menu it should be set in QChartView in Promoted Class Name, and QtCharts in Header file, then press the add button and finally press promote.

Screenshots of some steps:

[3.]

aPot0.png

[4.1]

<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值