void DefaultSimSubpanel::onRunPressed() { //disable buttons and menu left->ui->runButton->setEnabled(false); right->ui->widSimStyle->setVisible(false); //delete custom plot delete left->customPlot; left->customPlot = new QCustomPlot(); showCustomPlot(false); portsToPlot.erase(portsToPlot.begin(), portsToPlot.end()); //delte simulation thread delete sim_process; sim_process = new DefaultSimSubpanelThread(); sim_process->init(mvpm, mpkg); //delete set delete thread; thread = new QThread(); //move to thread sim_process->moveToThread(thread); connect(thread, SIGNAL(started()), sim_process, SLOT(onStarted())); connect(sim_process, SIGNAL(simulationFinished()), this, SLOT(onSimulationFinished())); thread->start(); }
void PlanSimSubpanel::onRunPressed() { // disable buttons and menu left->ui->runButton->setEnabled(false); right->ui->widSimStyle->setVisible(false); // delete custom plot //delete left->customPlot; delete left->planView; //left->customPlot = new QCustomPlot(); left->planView = new SvgView(left->ui->stackPlot); left->planView->loadTemplate(); showCustomPlot(false); portsToPlot.erase(portsToPlot.begin(), portsToPlot.end()); // prepare new thread for simulation log_messages.clear(); index_message = 0; delete sim_process; sim_process = new PlanSimSubpanelThread(log_messages, debug, nbthreads, blockSize); sim_process->init(mvpz, mpkg); // delete set delete thread; thread = new QThread(); // move to thread timer.start(1000); sim_process->moveToThread(thread); connect(thread, SIGNAL(started()), sim_process, SLOT(onStarted())); connect(sim_process, SIGNAL(simulationFinished()), this, SLOT(onSimulationFinished())); thread->start(); }