Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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
    {
        Q_OBJECT
    public:
        explicit ChartView(QWidget *parent = nullptr);
    };
    
    #endif // CHARTVIEW_H
    

  • Lifetime Qt Champion

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

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


Log in to reply