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

Chart display in tabWidget



  • How to display a chart in tabwidget?

        QLineSeries *series = new QLineSeries();
        for(int i=0;i<size; ++i)
        series->append(p_overpressure[i], alpha[i]);
        QChart *chart = new QChart();
        chart->legend()->hide();
        chart->addSeries(series);
        chart->createDefaultAxes();
        chart->setTitle("График изменения объемной доли газа в зависимости от давления в точке измерения");
        QChartView *chartView = new QChartView(chart);
        chartView->setRenderHint(QPainter::Antialiasing);
    

    In Example so

        QMainWindow window;
        window.setCentralWidget(chartView); // display in the window
        window.resize(400, 300);
        window.show();
    


  • Try adding a layout to your tab widget, and attach the chart to that layout.


Log in to reply