void ModelMgrWidget::setCurrentModel(const QString &model, bool notify) { if (!q_modelStack.isEmpty()) { if (q_modelStack.last() == model) { return; // 模式未改变 } } // q_modelStack.clear(); if (model == QStringLiteral("数据管理")) { q_modelStack << QStringLiteral("数据管理"); } else if (model == QStringLiteral("数据查询")) { q_modelStack << QStringLiteral("数据管理") << QStringLiteral("数据查询"); } else if (model == QStringLiteral("数据分析")) { q_modelStack << QStringLiteral("数据管理") << QStringLiteral("数据查询") << QStringLiteral("数据分析"); } // updateModels(); // if (notify) { Q_EMIT currentModelChanged(model); } }
void LayerWindow::modelAdded(Model * model) { std::cout << "Got add model" << std::endl << std::flush; Gtk::Menu * menu = m_modelMenu->get_menu(); bool newMenu = false; if (menu == NULL) { newMenu = true; menu = manage( new Gtk::Menu() ); m_modelMenu->set_menu(*menu); set_sensitive(true); } Gtk::Menu_Helpers::MenuList& model_menu = menu->items(); std::stringstream ident; ident << model->getName() << "-" << model->getModelNo(); model_menu.push_back(Gtk::Menu_Helpers::MenuElem(ident.str(), sigc::bind<Model*>(sigc::mem_fun(*this, &LayerWindow::currentModelChanged),model))); if (newMenu) { m_modelMenu->set_history(0); currentModelChanged(model); } }
TrialWidget::TrialWidget(QWidget *parent) : trialRunMode(TrialRunMode_Single), askDisableObserver(true), suspendingObservers(false), QWidget(parent), currentParamExplore(""), isStochastic(false) { trialFilter = new ObjectCacheFilter(SessionManager::instance()->descriptionCache, this); connect(SessionManager::instance(), SIGNAL(currentTrialChanged(QString)), trialFilter, SLOT(setName(QString))); connect(SessionManager::instance(), &SessionManager::currentTrialChanged, [=] (QString name) { if (name.isEmpty()) { execBuildComboBoxes(); } }); trialDescriptionUpdater = new ObjectUpdater(this); trialDescriptionUpdater->setProxyModel(trialFilter); connect(trialDescriptionUpdater,SIGNAL (objectUpdated(QDomDocument*, QString)), this,SLOT(buildComboBoxes(QDomDocument*))); // connect(trialDescriptionUpdater,SIGNAL (objectUpdated(QDomDocument*, QString)), // this,SIGNAL(trialDescriptionUpdated(QDomDocument*))); modelFilter = new ObjectCacheFilter(SessionManager::instance()->descriptionCache, this); connect(SessionManager::instance(), SIGNAL(currentModelChanged(QString)), modelFilter, SLOT(setName(QString))); connect(SessionManager::instance(), &SessionManager::currentModelChanged, [=](QString name) { if (name.isEmpty()) { setTrialRunMode(TrialRunMode_Single); setStochasticityVisible(false); } }); modelDescriptionUpdater = new ObjectUpdater(this); modelDescriptionUpdater->setProxyModel(modelFilter); connect(modelDescriptionUpdater,SIGNAL(objectUpdated(QDomDocument*, QString)), this, SLOT(updateModelStochasticity(QDomDocument*))); paramExploreFilter = new ObjectCacheFilter(SessionManager::instance()->descriptionCache, this); paramExploreDescriptionUpdater = new ObjectUpdater(this); paramExploreDescriptionUpdater->setProxyModel(paramExploreFilter); paramExploreDataframeFilter = new ObjectCacheFilter(SessionManager::instance()->dataframeCache, this); paramExploreDataframeUpdater = new ObjectUpdater(this); paramExploreDataframeUpdater->setProxyModel(paramExploreDataframeFilter); connect(paramExploreDataframeUpdater, SIGNAL(objectUpdated(QDomDocument*,QString)), this, SLOT(runParamExplore(QDomDocument*,QString))); setFilter = new ObjectCacheFilter(SessionManager::instance()->dataframeCache, this); hideSetComboBoxAction = new QAction(QIcon(":/images/icon_dismiss.png"),tr("&Hide"), this); hideSetComboBoxAction->setStatusTip(tr("Hide")); // connect(hideSetComboBoxAction,SIGNAL(triggered()),this,SLOT(hideSetComboBox())); connect(hideSetComboBoxAction, &QAction::triggered, [=](){setTrialRunMode(TrialRunMode_Single);}); buildWidget(); setTrialRunMode(TrialRunMode_Single); // hideSetComboBox(); disableObserversMsg = new QMessageBox( QMessageBox::Question, "Suspend layer activity recording", "You are about to run a list of trials while layer activity is being recorded and displayed in plots. " "This may slow down the simulation.\n" "Do you want to suspend activity recording while running a list of trials?", QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this); dontAskAgainDisableObserverCheckBox = new QCheckBox("don't show this message again"); disableObserversMsg->setCheckBox(dontAskAgainDisableObserverCheckBox); }