I've created an UI with qt Creator,in this UI there is just a button and a widget (let's call it respectively button and char_container); I need to add a chartview programmatically inside the chart_container. I didn't change the default layout.
I've tried the following code,but it does not work:
void MainWindow::button_slot(){
QtCharts::QChart *chart = new QtCharts::QChart();
QtCharts::QChartView *chartView = new QtCharts::QChartView(chart);
chartView->setParent(ui->chart_container);
this.repaint();
}