void MainWindow::on_actionRemove_plot_triggered() { QAction * action = qobject_cast<QAction *>(sender()); PlotWidget * plot =qobject_cast<PlotWidget*> (action->property("Plot").value<QWidget*>()); Q_ASSERT(plot); PlotList.removeOne(plot); plot->deleteLater(); }
void MainWindow::on_actionAdd_new_plot_triggered() { PlotWidget * plot = new PlotWidget(this); PlotConfigurationDialog dlg(*plot,variables,this); if (dlg.exec() == QDialog::Accepted) { connect(plot,SIGNAL(customContextMenuRequested(QPoint)),this, SLOT(PlotContextMenuRequest(QPoint))); PlotList.push_back(plot); GraphSplitter->addWidget(plot); //connect(this,SIGNAL(TimerStart()),plot,SLOT(Start())); } else { plot->deleteLater(); } }