void ClangDiagnosticConfigsWidget::onClangTidyItemChanged(QListWidgetItem *item)
{
    const QString prefix = item->text();
    ClangDiagnosticConfig config = currentConfig();
    QString checks = config.clangTidyChecksPrefixes();
    item->checkState() == Qt::Checked
            ? checks.append(',' + prefix)
            : checks.remove(',' + prefix);
    config.setClangTidyChecksPrefixes(checks);
    updateConfig(config);
}
void ClangDiagnosticConfigsWidget::syncTidyChecksList(const ClangDiagnosticConfig &config)
{
    const QString tidyChecks = config.clangTidyChecksPrefixes();
    for (int row = 0; row < m_tidyChecks->checksPrefixesList->count(); ++row) {
        QListWidgetItem *item = m_tidyChecks->checksPrefixesList->item(row);

        Qt::ItemFlags flags = item->flags();
        flags |= Qt::ItemIsUserCheckable;
        if (config.isReadOnly())
            flags &= ~Qt::ItemIsEnabled;
        else
            flags |= Qt::ItemIsEnabled;
        item->setFlags(flags);

        if (tidyChecks.indexOf(item->text()) != -1)
            item->setCheckState(Qt::Checked);
        else
            item->setCheckState(Qt::Unchecked);
    }
}