Drop Qt5: Clang, QBS & Valgrind: Get rid of QOverload

Change-Id: I86697f07a8dce5674d6e748bce807df59b773227
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2022-07-19 23:29:42 +02:00
parent 1b070bcb11
commit 683ad910b8
17 changed files with 44 additions and 62 deletions

View File

@@ -147,7 +147,7 @@ void ClangFormatConfigWidget::initCheckBoxes()
m_ui->formatWhileTyping->setEnabled(isFormatting);
};
setEnableCheckBoxes(m_ui->indentingOrFormatting->currentIndex());
connect(m_ui->indentingOrFormatting, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(m_ui->indentingOrFormatting, &QComboBox::currentIndexChanged,
this, setEnableCheckBoxes);
m_ui->formatOnSave->setChecked(ClangFormatSettings::instance().formatOnSave());
@@ -196,10 +196,8 @@ void ClangFormatConfigWidget::connectChecks()
for (QObject *child : m_checksWidget->children()) {
auto comboBox = qobject_cast<QComboBox *>(child);
if (comboBox != nullptr) {
connect(comboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&ClangFormatConfigWidget::onTableChanged);
connect(comboBox, &QComboBox::currentIndexChanged,
this, &ClangFormatConfigWidget::onTableChanged);
comboBox->installEventFilter(this);
continue;
}
@@ -234,12 +232,11 @@ void ClangFormatConfigWidget::initIndentationOrFormattingCombobox()
m_ui->indentingOrFormatting->setVisible(isGlobal);
m_ui->formattingModeLabel->setVisible(isGlobal);
connect(m_ui->indentingOrFormatting, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [](int index) {
ClangFormatSettings &settings = ClangFormatSettings::instance();
settings.setMode(static_cast<ClangFormatSettings::Mode>(index));
settings.write();
});
connect(m_ui->indentingOrFormatting, &QComboBox::currentIndexChanged, this, [](int index) {
ClangFormatSettings &settings = ClangFormatSettings::instance();
settings.setMode(static_cast<ClangFormatSettings::Mode>(index));
settings.write();
});
}
static bool projectConfigExists()
@@ -361,7 +358,7 @@ static void fillComboBoxOrLineEdit(QObject *object, const std::string &text, siz
void ClangFormatConfigWidget::fillTable()
{
Utils::ExecuteOnDestruction executeOnDestruction([this]() { m_disableTableUpdate = false; });
Utils::ExecuteOnDestruction executeOnDestruction([this] { m_disableTableUpdate = false; });
m_disableTableUpdate = true;
const std::string configText = readFile(m_config->filePath().path());

View File

@@ -462,7 +462,7 @@ ClangTool::ClangTool()
action->setDisabled(true);
action->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
action->setToolTip(tr("Clear"));
connect(action, &QAction::triggered, this, [this]() {
connect(action, &QAction::triggered, this, [this] {
reset();
update();
});
@@ -498,7 +498,7 @@ ClangTool::ClangTool()
m_selectFixitsCheckBox->setText("Select Fixits");
m_selectFixitsCheckBox->setEnabled(false);
m_selectFixitsCheckBox->setTristate(true);
connect(m_selectFixitsCheckBox, &QCheckBox::clicked, this, [this]() {
connect(m_selectFixitsCheckBox, &QCheckBox::clicked, this, [this] {
m_diagnosticView->scheduleAllFixits(m_selectFixitsCheckBox->isChecked());
});
@@ -524,7 +524,7 @@ ClangTool::ClangTool()
updateForCurrentState();
});
connect(m_applyFixitsButton, &QToolButton::clicked, [this]() {
connect(m_applyFixitsButton, &QToolButton::clicked, [this] {
QVector<DiagnosticItem *> diagnosticItems;
m_diagnosticModel->forItemsAtLevel<2>([&](DiagnosticItem *item){
diagnosticItems += item;
@@ -562,7 +562,7 @@ ClangTool::ClangTool()
action->setToolTip(toolTip);
menu->addAction(ActionManager::registerAction(action, "ClangTidyClazy.Action"),
Debugger::Constants::G_ANALYZER_TOOLS);
QObject::connect(action, &QAction::triggered, this, [this]() {
QObject::connect(action, &QAction::triggered, this, [this] {
startTool(FileSelectionType::AskUser);
});
QObject::connect(m_startAction, &QAction::triggered, action, &QAction::triggered);
@@ -692,7 +692,7 @@ void ClangTool::startTool(ClangTool::FileSelection fileSelection,
connect(m_runWorker, &ClangToolRunWorker::buildFailed,this, &ClangTool::onBuildFailed);
connect(m_runWorker, &ClangToolRunWorker::startFailed, this, &ClangTool::onStartFailed);
connect(m_runWorker, &ClangToolRunWorker::started, this, &ClangTool::onStarted);
connect(m_runWorker, &ClangToolRunWorker::runnerFinished, this, [this]() {
connect(m_runWorker, &ClangToolRunWorker::runnerFinished, this, [this] {
m_filesCount = m_runWorker->totalFilesToAnalyze();
m_filesSucceeded = m_runWorker->filesAnalyzed();
m_filesFailed = m_runWorker->filesNotAnalyzed();
@@ -1017,17 +1017,15 @@ void ClangTool::filterOutCurrentKind()
void ClangTool::onBuildFailed()
{
m_infoBarWidget->setError(InfoBarWidget::Error,
tr("Failed to build the project."),
[this]() { showOutputPane(); });
m_infoBarWidget->setError(InfoBarWidget::Error, tr("Failed to build the project."),
[this] { showOutputPane(); });
setState(State::PreparationFailed);
}
void ClangTool::onStartFailed()
{
m_infoBarWidget->setError(InfoBarWidget::Error,
makeLink(tr("Failed to start the analyzer.")),
[this]() { showOutputPane(); });
m_infoBarWidget->setError(InfoBarWidget::Error, makeLink(tr("Failed to start the analyzer.")),
[this] { showOutputPane(); });
setState(State::PreparationFailed);
}
@@ -1170,7 +1168,7 @@ void ClangTool::updateForCurrentState()
const bool hasErrors = m_filesFailed > 0;
if (hasErrors && !hasErrorText) {
const QString text = makeLink(tr("Failed to analyze %n file(s).", nullptr, m_filesFailed));
m_infoBarWidget->setError(InfoBarWidget::Warning, text, [this]() { showOutputPane(); });
m_infoBarWidget->setError(InfoBarWidget::Warning, text, [this] { showOutputPane(); });
}
// Info bar: info

View File

@@ -197,10 +197,10 @@ QList<RunnerCreator> ClangToolRunWorker::runnerCreators()
QList<RunnerCreator> creators;
if (m_diagnosticConfig.isClangTidyEnabled())
creators << [this]() { return createRunner<ClangTidyRunner>(); };
creators << [this] { return createRunner<ClangTidyRunner>(); };
if (m_diagnosticConfig.isClazyEnabled())
creators << [this]() { return createRunner<ClazyStandaloneRunner>(); };
creators << [this] { return createRunner<ClazyStandaloneRunner>(); };
return creators;
}

View File

@@ -512,7 +512,7 @@ DiagnosticFilterModel::DiagnosticFilterModel(QObject *parent)
if (!m_project && project->projectDirectory() == m_lastProjectDirectory)
setProject(project);
});
connect(this, &QAbstractItemModel::modelReset, this, [this]() {
connect(this, &QAbstractItemModel::modelReset, this, [this] {
reset();
emit fixitCountersChanged(m_fixitsScheduled, m_fixitsScheduable);
});

View File

@@ -86,9 +86,7 @@ public:
bool wait()
{
return processEventsUntil([this]() {
return m_projectsToWaitFor.isEmpty();
});
return processEventsUntil([this] { return m_projectsToWaitFor.isEmpty(); });
}
private:

View File

@@ -122,7 +122,7 @@ ClangToolsProjectSettingsWidget::ClangToolsProjectSettingsWidget(ProjectExplorer
&ClangToolsSettings::changed,
this,
QOverload<>::of(&ClangToolsProjectSettingsWidget::onGlobalCustomChanged));
connect(m_restoreGlobal, &QPushButton::clicked, this, [this]() {
connect(m_restoreGlobal, &QPushButton::clicked, this, [this] {
m_runSettingsWidget->fromSettings(ClangToolsSettings::instance()->runSettings());
});
@@ -131,7 +131,7 @@ ClangToolsProjectSettingsWidget::ClangToolsProjectSettingsWidget(ProjectExplorer
});
// Run options
connect(m_runSettingsWidget, &RunSettingsWidget::changed, this, [this]() {
connect(m_runSettingsWidget, &RunSettingsWidget::changed, this, [this] {
// Save project run settings
m_projectSettings->setRunSettings(m_runSettingsWidget->toSettings());

View File

@@ -845,7 +845,7 @@ DiagnosticConfigsWidget::DiagnosticConfigsWidget(const ClangDiagnosticConfigs &c
auto topicsModel = new QStringListModel(Utils::toList(m_clazyTreeModel->topics()), this);
topicsModel->sort(0);
m_clazyChecks->topicsView->setModel(topicsModel);
connect(m_clazyChecks->topicsResetButton, &QPushButton::clicked, [this](){
connect(m_clazyChecks->topicsResetButton, &QPushButton::clicked, this, [this] {
m_clazyChecks->topicsView->clearSelection();
});
m_clazyChecks->topicsView->setSelectionMode(QAbstractItemView::MultiSelection);
@@ -920,7 +920,7 @@ DiagnosticConfigsWidget::DiagnosticConfigsWidget(const ClangDiagnosticConfigs &c
openUrl(m_tidyTreeModel.get(), index);
});
connect(m_tidyChecks->plainTextEditButton, &QPushButton::clicked, this, [this]() {
connect(m_tidyChecks->plainTextEditButton, &QPushButton::clicked, this, [this] {
const bool readOnly = currentConfig().isReadOnly();
QDialog dialog;
@@ -1055,20 +1055,16 @@ void DiagnosticConfigsWidget::syncExtraWidgets(const ClangDiagnosticConfig &conf
void DiagnosticConfigsWidget::connectClangTidyItemChanged()
{
connect(m_tidyChecks->tidyMode,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&DiagnosticConfigsWidget::onClangTidyModeChanged);
connect(m_tidyChecks->tidyMode, &QComboBox::currentIndexChanged,
this, &DiagnosticConfigsWidget::onClangTidyModeChanged);
connect(m_tidyTreeModel.get(), &TidyChecksTreeModel::dataChanged,
this, &DiagnosticConfigsWidget::onClangTidyTreeChanged);
}
void DiagnosticConfigsWidget::disconnectClangTidyItemChanged()
{
disconnect(m_tidyChecks->tidyMode,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&DiagnosticConfigsWidget::onClangTidyModeChanged);
disconnect(m_tidyChecks->tidyMode, &QComboBox::currentIndexChanged,
this, &DiagnosticConfigsWidget::onClangTidyModeChanged);
disconnect(m_tidyTreeModel.get(), &TidyChecksTreeModel::dataChanged,
this, &DiagnosticConfigsWidget::onClangTidyTreeChanged);
}

View File

@@ -103,7 +103,7 @@ FilterDialog::FilterDialog(const Checks &checks, QWidget *parent)
// Buttons
connect(m_ui->selectNone, &QPushButton::clicked, m_ui->view, &QTreeView::clearSelection);
connect(m_ui->selectAll, &QPushButton::clicked, m_ui->view, &QTreeView::selectAll);
connect(m_ui->selectWithFixits, &QPushButton::clicked, m_ui->view, [this](){
connect(m_ui->selectWithFixits, &QPushButton::clicked, m_ui->view, [this] {
m_ui->view->clearSelection();
m_model->forItemsAtLevel<1>([&](CheckItem *item) {
if (item->check.hasFixit)

View File

@@ -109,9 +109,7 @@ void RunSettingsWidget::fromSettings(const RunSettings &s)
m_ui->parallelJobsSpinBox->setValue(s.parallelJobs());
m_ui->parallelJobsSpinBox->setMinimum(1);
m_ui->parallelJobsSpinBox->setMaximum(QThread::idealThreadCount());
connect(m_ui->parallelJobsSpinBox,
QOverload<int>::of(&QSpinBox::valueChanged),
[this](int) { emit changed(); });
connect(m_ui->parallelJobsSpinBox, &QSpinBox::valueChanged, this, &RunSettingsWidget::changed);
m_ui->analyzeOpenFiles->setChecked(s.analyzeOpenFiles());
connect(m_ui->analyzeOpenFiles, &QCheckBox::toggled, this, &RunSettingsWidget::changed);

View File

@@ -124,7 +124,7 @@ QbsProfileManager::QbsProfileManager() : m_defaultPropertyProvider(new DefaultPr
setObjectName(QLatin1String("QbsProjectManager"));
connect(ProjectExplorer::KitManager::instance(), &ProjectExplorer::KitManager::kitsLoaded, this,
[this]() { m_kitsToBeSetupForQbs = ProjectExplorer::KitManager::kits(); } );
[this] { m_kitsToBeSetupForQbs = ProjectExplorer::KitManager::kits(); } );
connect(ProjectExplorer::KitManager::instance(), &ProjectExplorer::KitManager::kitAdded, this,
&QbsProfileManager::addProfileFromKit);
connect(ProjectExplorer::KitManager::instance(), &ProjectExplorer::KitManager::kitUpdated, this,

View File

@@ -181,8 +181,7 @@ void QbsProfilesSettingsWidget::refreshKitsList()
else if (hasKits)
m_ui.kitsComboBox->setCurrentIndex(0);
displayCurrentProfile();
connect(m_ui.kitsComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(m_ui.kitsComboBox, &QComboBox::currentIndexChanged,
this, &QbsProfilesSettingsWidget::displayCurrentProfile);
}

View File

@@ -984,8 +984,7 @@ InternalLibraryDetailsController::InternalLibraryDetailsController(Ui::LibraryDe
if (HostOsInfo::isWindowsHost())
libraryDetailsWidget()->useSubfoldersCheckBox->setEnabled(true);
connect(libraryDetailsWidget()->libraryComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(libraryDetailsWidget()->libraryComboBox, &QComboBox::currentIndexChanged,
this, &InternalLibraryDetailsController::slotCurrentLibraryChanged);
updateProFile();

View File

@@ -307,7 +307,7 @@ public:
ExampleSetModel *exampleSetModel = m_examplesModel->exampleSetModel();
exampleSetSelector->setModel(exampleSetModel);
exampleSetSelector->setCurrentIndex(exampleSetModel->selectedExampleSet());
connect(exampleSetSelector, QOverload<int>::of(&QComboBox::activated),
connect(exampleSetSelector, &QComboBox::activated,
exampleSetModel, &ExampleSetModel::selectExampleSet);
connect(exampleSetModel, &ExampleSetModel::selectedExampleSetChanged,
exampleSetSelector, &QComboBox::setCurrentIndex);

View File

@@ -67,9 +67,8 @@ public:
refresh();
m_combo->setToolTip(ki->description());
connect(m_combo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(m_combo, &QComboBox::currentIndexChanged,
this, &QtKitAspectWidget::currentWasChanged);
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged,
this, &QtKitAspectWidget::versionsChanged);
}

View File

@@ -119,7 +119,7 @@ TranslationWizardPage::TranslationWizardPage(const QString &enabledExpr)
fileNameLayout->addWidget(&m_fileNameLineEdit);
fileNameLayout->addStretch(1);
formLayout->addRow(tr("Translation file:"), fileNameLayout);
connect(&m_languageComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(&m_languageComboBox, &QComboBox::currentIndexChanged,
this, &TranslationWizardPage::updateLineEdit);
}

View File

@@ -433,7 +433,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
// event selection
m_eventCombo = new QComboBox;
m_eventCombo->setToolTip(Tr::tr("Selects which events from the profiling data are shown and visualized."));
connect(m_eventCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(m_eventCombo, &QComboBox::currentIndexChanged,
this, &CallgrindToolPrivate::setCostEvent);
updateEventCombo();

View File

@@ -1237,8 +1237,7 @@ HeobDialog::HeobDialog(QWidget *parent) :
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(1);
m_profilesCombo->setSizePolicy(sizePolicy);
connect(m_profilesCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &HeobDialog::updateProfile);
connect(m_profilesCombo, &QComboBox::currentIndexChanged, this, &HeobDialog::updateProfile);
profilesLayout->addWidget(m_profilesCombo);
auto profileNewButton = new QPushButton(tr("New"));
connect(profileNewButton, &QAbstractButton::clicked, this, &HeobDialog::newProfileDialog);
@@ -1262,7 +1261,7 @@ HeobDialog::HeobDialog(QWidget *parent) :
m_handleExceptionCombo->addItem(tr("Off"));
m_handleExceptionCombo->addItem(tr("On"));
m_handleExceptionCombo->addItem(tr("Only"));
connect(m_handleExceptionCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(m_handleExceptionCombo, &QComboBox::currentIndexChanged,
this, &HeobDialog::updateEnabled);
handleExceptionLayout->addWidget(m_handleExceptionCombo);
layout->addLayout(handleExceptionLayout);
@@ -1274,7 +1273,7 @@ HeobDialog::HeobDialog(QWidget *parent) :
m_pageProtectionCombo->addItem(tr("Off"));
m_pageProtectionCombo->addItem(tr("After"));
m_pageProtectionCombo->addItem(tr("Before"));
connect(m_pageProtectionCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(m_pageProtectionCombo, &QComboBox::currentIndexChanged,
this, &HeobDialog::updateEnabled);
pageProtectionLayout->addWidget(m_pageProtectionCombo);
layout->addLayout(pageProtectionLayout);
@@ -1295,8 +1294,7 @@ HeobDialog::HeobDialog(QWidget *parent) :
m_leakDetailCombo->addItem(tr("Detect Leak Types (Show Reachable)"));
m_leakDetailCombo->addItem(tr("Fuzzy Detect Leak Types"));
m_leakDetailCombo->addItem(tr("Fuzzy Detect Leak Types (Show Reachable)"));
connect(m_leakDetailCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &HeobDialog::updateEnabled);
connect(m_leakDetailCombo, &QComboBox::currentIndexChanged, this, &HeobDialog::updateEnabled);
leakDetailLayout->addWidget(m_leakDetailCombo);
layout->addLayout(leakDetailLayout);