Important: Please read the Qt Code of Conduct -

Add QChartView to Qt Desiner like custom widget

  • Trying to add QChartView to qt designer. I making "Promote to...", then "Promote" QGraphicsView to QChartView.
    alt text

    But compiler gives an error in auto generated ui file:

    alt text
    *C:\Users\Shmeisser\Documents\build-DBHandler-Desktop_Qt_5_7_1_MinGW_32bit-Debug\ui_dbanalyzewindow.h:30: error: 'QChartView' does not name a type
    QChartView graphicsView;

    What could be the problem? QT+= charts added in .pro file.

  • Moderators

    You've got the includes and class name wrong (it should be in a namespace).
    In the promotion dialog make sure you set up the name/includes as follows:

    Base class name: QWidget
    Promoted class name: QtCharts::QChartView
    Header file: QtCharts/QChartView
    Global include: checked

  • Thanks, it works!

Log in to reply