Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QChartView - 'is private within the contect'



  • The following error just recently happen with one header file of my program. If always compiled fine before that.

    QChartView /home/programming/chartview.h:9: error: ‘QtCharts::QChartView::QChartView(const QtCharts::QChartView&)’ is private within this context
    

    Can't find the solution. Does anyone know how to address this?

    helper.h
    
    #ifndef CHARTVIEW_H
    #define CHARTVIEW_H
    
    #include <QtCharts/QChartView>
    #include <QtWidgets>
    #include <QtCharts>
    
    class ChartView : public QChartView{
    
    public:
        ChartView(QChart *chart, QWidget *parent = 0);
        QLineSeries *hLine;
        QLineSeries *vLine;
        bool isDoneDrawing;
        void doneDrawing(bool newValue);
    
    protected:
        void mouseMoveEvent(QMouseEvent *event);
    
    };
    #endif

  • Qt Champions 2019

    Please post the whole error message and not only the last line. You're trying to copy a ChartView object somewhere in your code which is not allowed.



  • That was to whole error. As for code I have too much to post.

    Anyhow I fixed it by creating a new header file, copying the contents from the original header file into the new one, deleting the original and renaming the new header file to the name of the original one.