static QString displayNameWithBuiltinIndication(const ClangDiagnosticConfig &config, const Core::Id &exceptionalConfig) { if (exceptionalConfig == config.id()) return config.displayName(); return ClangDiagnosticConfigsModel::displayNameWithBuiltinIndication(config); }
void ClangDiagnosticConfigsModel::appendOrUpdate(const ClangDiagnosticConfig &config) { const int index = indexOfConfig(config.id()); if (index >= 0 && index < m_diagnosticConfigs.size()) m_diagnosticConfigs.replace(index, config); else m_diagnosticConfigs.append(config); }
void ClangDiagnosticConfigsWidget::onCopyButtonClicked() { const ClangDiagnosticConfig &config = currentConfig(); bool diaglogAccepted = false; const QString newName = QInputDialog::getText(this, tr("Copy Diagnostic Configuration"), tr("Diagnostic configuration name:"), QLineEdit::Normal, tr("%1 (Copy)").arg(config.displayName()), &diaglogAccepted); if (diaglogAccepted) { const ClangDiagnosticConfig customConfig = createCustomConfig(config, newName); m_diagnosticConfigsModel.appendOrUpdate(customConfig); emit customConfigsChanged(customConfigs()); syncConfigChooserToModel(customConfig.id()); m_ui->diagnosticOptionsTextEdit->setFocus(); } }