admin管理员组

文章数量:1667288

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.]

本文标签: 窗体如何使用qchartqtvsQChartView