void QQBoardsSettings::olccsAddBouchot() { QQBoardWizard wizard(this); if(wizard.exec() == QDialog::Accepted) { QQBouchot::QQBouchotSettings bSettings = wizard.bouchotSettings(); QString bouchotName = wizard.bouchotName(); if(m_listNames.contains(bouchotName)) { qWarning() << "Trying to insert a bouchot with an already existing name, that's forbidden"; } else { m_listNames.append(bouchotName); if(! m_listGroups.contains(bSettings.group())) m_listGroups.append(bSettings.group()); QStringListModel *model = (QStringListModel *) ui->bouchotListView->model(); int numRow = model->rowCount(); model->insertRows(numRow, 1); model->setData(model->index(numRow), QVariant(bouchotName)); m_newBouchots.insert(bouchotName, bSettings); m_oldBouchots.removeAll(bouchotName); } if(wizard.showAdvanced()) { QStringListModel *model = (QStringListModel *) ui->bouchotListView->model(); QItemSelectionModel *selModel = ui->bouchotListView->selectionModel(); for(int i = 0; i < model->rowCount(); i++) { QModelIndex mIndex = model->index(i); if(model->data(mIndex, Qt::EditRole).toString() == bouchotName) { selModel->select(mIndex, QItemSelectionModel::ClearAndSelect); editBouchot(); } } } } }