void ChangeParameters::undo() { NodeItem *item = scene->findItem(id); Q_ASSERT(item != 0); item->getNode()->deinit(); item->restoreParameters(before); SimulationParameters sp = scene->simulation->getSimulationParameters(); item->getNode()->init(sp.start + seconds(sp.dt), sp.stop, sp.dt); item->updatePorts(); //scene->update(); scene->updateConnections(item); }
void DeleteNode::undo() { Node *node = scene->node_reg->createNode(node_class); scene->model->addNode(node_id, node); NodeItem *nitem = new NodeItem(node); nitem->restoreParameters(parameters); SimulationParameters sp = scene->simulation->getSimulationParameters(); node->init(sp.start + seconds(sp.dt), sp.stop, sp.dt); nitem->updatePorts(); nitem->setPos(pos); scene->add(nitem); //scene->update(); }
void ChangeParameters::redo() { if (first_redo) { first_redo = false; return; } NodeItem *item = scene->findItem(id); Q_ASSERT(item != 0); item->getNode()->deinit(); item->restoreParameters(after); SimulationParameters sp = scene->simulation->getSimulationParameters(); item->getNode()->init(sp.start + seconds(sp.dt), sp.stop, sp.dt); item->updatePorts(); //scene->update(); scene->updateConnections(item); }