Important: Please read the 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?

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

  • Lifetime Qt Champion

    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.