Important: Please read the Qt Code of Conduct -

QChartView inherits

  • Hi,

    I have a problem. I try to make a class that will be a QWidget and will inherit from QChartView. But I gets error during compilation:

    chartview.h:8: error: expected class-name before ‘{’ token

    #ifndef CHARTVIEW_H
    #define CHARTVIEW_H
    #include <QChartView>
    class ChartView : public QChartView
        explicit ChartView(QWidget *parent = nullptr);
    #endif // CHARTVIEW_H

  • Lifetime Qt Champion

    Do you have QT += charts
    in the .pro file ?

    (remember to clean all, rebuild all if you add it )

Log in to reply