Drop Qt5: Core: Get rid of QOverload

Change-Id: Ibaebd83304680156e13a9ebc473075ad2a4bfed4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Jarek Kobus
2022-07-19 22:37:03 +02:00
parent 74ea4dc07d
commit 0dae822ca3
21 changed files with 35 additions and 49 deletions

View File

@@ -496,9 +496,9 @@ ExternalToolConfig::ExternalToolConfig()
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(m_ui.environmentButton, &QAbstractButton::clicked, connect(m_ui.environmentButton, &QAbstractButton::clicked,
this, &ExternalToolConfig::editEnvironmentChanges); this, &ExternalToolConfig::editEnvironmentChanges);
connect(m_ui.outputBehavior, QOverload<int>::of(&QComboBox::activated), connect(m_ui.outputBehavior, &QComboBox::activated,
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(m_ui.errorOutputBehavior, QOverload<int>::of(&QComboBox::activated), connect(m_ui.errorOutputBehavior, &QComboBox::activated,
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);
connect(m_ui.modifiesDocumentCheckbox, &QAbstractButton::clicked, connect(m_ui.modifiesDocumentCheckbox, &QAbstractButton::clicked,
this, &ExternalToolConfig::updateCurrentItem); this, &ExternalToolConfig::updateCurrentItem);

View File

@@ -221,7 +221,7 @@ NewDialogWidget::NewDialogWidget(QWidget *parent) :
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &NewDialogWidget::accept); connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &NewDialogWidget::accept);
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &NewDialogWidget::reject); connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &NewDialogWidget::reject);
connect(m_ui->comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(m_ui->comboBox, &QComboBox::currentIndexChanged,
this, &NewDialogWidget::setSelectedPlatform); this, &NewDialogWidget::setSelectedPlatform);
} }

View File

@@ -466,7 +466,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const FilePaths &filePaths)
// Also save the buttongroup for every file to get the result for each entry. // Also save the buttongroup for every file to get the result for each entry.
buttonGroups.append({filePath, radioButtonGroup}); buttonGroups.append({filePath, radioButtonGroup});
QObject::connect(radioButtonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), QObject::connect(radioButtonGroup, &QButtonGroup::buttonClicked,
[this] { updateSelectAll(); }); [this] { updateSelectAll(); });
} }
@@ -525,8 +525,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const FilePaths &filePaths)
ui.setAll->addItem(saveAsText); ui.setAll->addItem(saveAsText);
setAllIndexForOperation[SaveAs] = ui.setAll->count() - 1; setAllIndexForOperation[SaveAs] = ui.setAll->count() - 1;
} }
QObject::connect(ui.setAll, QOverload<int>::of(&QComboBox::activated), QObject::connect(ui.setAll, &QComboBox::activated, [this](int index) { setAll(index); });
[this](int index) { setAll(index); });
// Filter which columns should be visible and resize them to content. // Filter which columns should be visible and resize them to content.
for (int i = 0; i < NumberOfColumns; ++i) { for (int i = 0; i < NumberOfColumns; ++i) {

View File

@@ -76,7 +76,7 @@ EditorWindow::EditorWindow(QWidget *parent) :
connect(m_area, &EditorArea::windowTitleNeedsUpdate, connect(m_area, &EditorArea::windowTitleNeedsUpdate,
this, &EditorWindow::updateWindowTitle); this, &EditorWindow::updateWindowTitle);
// editor area can be deleted by editor manager // editor area can be deleted by editor manager
connect(m_area, &EditorArea::destroyed, this, [this]() { connect(m_area, &EditorArea::destroyed, this, [this] {
m_area = nullptr; m_area = nullptr;
deleteLater(); deleteLater();
}); });

View File

@@ -187,15 +187,13 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
// this signal is disconnected for standalone toolbars and replaced with // this signal is disconnected for standalone toolbars and replaced with
// a private slot connection // a private slot connection
connect(d->m_editorList, QOverload<int>::of(&QComboBox::activated), connect(d->m_editorList, &QComboBox::activated, this, &EditorToolBar::listSelectionActivated);
this, &EditorToolBar::listSelectionActivated);
connect(d->m_editorList, &QComboBox::customContextMenuRequested, [this](QPoint p) { connect(d->m_editorList, &QComboBox::customContextMenuRequested, [this](QPoint p) {
QMenu menu; QMenu menu;
fillListContextMenu(&menu); fillListContextMenu(&menu);
menu.exec(d->m_editorList->mapToGlobal(p)); menu.exec(d->m_editorList->mapToGlobal(p));
}); });
connect(d->m_dragHandleMenu, &QMenu::aboutToShow, [this]() { connect(d->m_dragHandleMenu, &QMenu::aboutToShow, this, [this] {
d->m_dragHandleMenu->clear(); d->m_dragHandleMenu->clear();
fillListContextMenu(d->m_dragHandleMenu); fillListContextMenu(d->m_dragHandleMenu);
}); });
@@ -300,9 +298,9 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags)
this, this,
&EditorToolBar::setCurrentEditor); &EditorToolBar::setCurrentEditor);
disconnect(d->m_editorList, QOverload<int>::of(&QComboBox::activated), disconnect(d->m_editorList, &QComboBox::activated,
this, &EditorToolBar::listSelectionActivated); this, &EditorToolBar::listSelectionActivated);
connect(d->m_editorList, QOverload<int>::of(&QComboBox::activated), connect(d->m_editorList, &QComboBox::activated,
this, &EditorToolBar::changeActiveEditor); this, &EditorToolBar::changeActiveEditor);
d->m_splitButton->setVisible(false); d->m_splitButton->setVisible(false);
d->m_closeSplitButton->setVisible(false); d->m_closeSplitButton->setVisible(false);

View File

@@ -221,7 +221,7 @@ void FancyTabBar::mousePressEvent(QMouseEvent *event)
m_currentIndex = index; m_currentIndex = index;
update(); update();
// update tab bar before showing widget // update tab bar before showing widget
QMetaObject::invokeMethod(this, [this]() { QMetaObject::invokeMethod(this, [this] {
emit currentChanged(m_currentIndex); emit currentChanged(m_currentIndex);
}, Qt::QueuedConnection); }, Qt::QueuedConnection);
} }

View File

@@ -167,13 +167,13 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
cmd = ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT); cmd = ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT);
cmd->setDefaultKeySequence(QKeySequence::Find); cmd->setDefaultKeySequence(QKeySequence::Find);
mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT); mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT);
connect(m_findInDocumentAction, &QAction::triggered, this, [this]() { openFind(); }); connect(m_findInDocumentAction, &QAction::triggered, this, [this] { openFind(); });
// Pressing the find shortcut while focus is in the tool bar should not change the search text, // Pressing the find shortcut while focus is in the tool bar should not change the search text,
// so register a different find action for the tool bar // so register a different find action for the tool bar
auto localFindAction = new QAction(this); auto localFindAction = new QAction(this);
ActionManager::registerAction(localFindAction, Constants::FIND_IN_DOCUMENT, findcontext); ActionManager::registerAction(localFindAction, Constants::FIND_IN_DOCUMENT, findcontext);
connect(localFindAction, &QAction::triggered, this, [this]() { connect(localFindAction, &QAction::triggered, this, [this] {
openFindToolBar(FindToolBar::OpenFlags(UpdateAll & ~UpdateFindText)); openFindToolBar(FindToolBar::OpenFlags(UpdateAll & ~UpdateFindText));
}); });

View File

@@ -77,7 +77,7 @@ FindToolWindow::FindToolWindow(QWidget *parent)
connect(m_ui.matchCase, &QAbstractButton::toggled, Find::instance(), &Find::setCaseSensitive); connect(m_ui.matchCase, &QAbstractButton::toggled, Find::instance(), &Find::setCaseSensitive);
connect(m_ui.wholeWords, &QAbstractButton::toggled, Find::instance(), &Find::setWholeWord); connect(m_ui.wholeWords, &QAbstractButton::toggled, Find::instance(), &Find::setWholeWord);
connect(m_ui.regExp, &QAbstractButton::toggled, Find::instance(), &Find::setRegularExpression); connect(m_ui.regExp, &QAbstractButton::toggled, Find::instance(), &Find::setRegularExpression);
connect(m_ui.filterList, QOverload<int>::of(&QComboBox::activated), connect(m_ui.filterList, &QComboBox::activated,
this, QOverload<int>::of(&FindToolWindow::setCurrentFilter)); this, QOverload<int>::of(&FindToolWindow::setCurrentFilter));
m_findCompleter->setModel(Find::findCompletionModel()); m_findCompleter->setModel(Find::findCompletionModel());

View File

@@ -284,8 +284,8 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
InfoBarEntry info(sizeWarningId, InfoBarEntry info(sizeWarningId,
tr("The search resulted in more than %n items, do you still want to continue?", tr("The search resulted in more than %n items, do you still want to continue?",
nullptr, SEARCHRESULT_WARNING_LIMIT)); nullptr, SEARCHRESULT_WARNING_LIMIT));
info.setCancelButtonInfo(tr("Cancel"), [this]() { cancelAfterSizeWarning(); }); info.setCancelButtonInfo(tr("Cancel"), [this] { cancelAfterSizeWarning(); });
info.addCustomButton(tr("Continue"), [this]() { continueAfterSizeWarning(); }); info.addCustomButton(tr("Continue"), [this] { continueAfterSizeWarning(); });
m_infoBar.addInfo(info); m_infoBar.addInfo(info);
emit requestPopup(false/*no focus*/); emit requestPopup(false/*no focus*/);
} }

View File

@@ -650,10 +650,8 @@ QList<QWidget *> SearchResultWindowPrivate::toolBarWidgets()
m_recentSearchesBox->setProperty("drawleftborder", true); m_recentSearchesBox->setProperty("drawleftborder", true);
m_recentSearchesBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_recentSearchesBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
m_recentSearchesBox->addItem(tr("New Search")); m_recentSearchesBox->addItem(tr("New Search"));
connect(m_recentSearchesBox, connect(m_recentSearchesBox, &QComboBox::activated,
QOverload<int>::of(&QComboBox::activated), this, &SearchResultWindowPrivate::setCurrentIndexWithFocus);
this,
&SearchResultWindowPrivate::setCurrentIndexWithFocus);
} }
return {m_expandCollapseButton, return {m_expandCollapseButton,
m_filterButton, m_filterButton,

View File

@@ -388,11 +388,8 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
this, this,
&FolderNavigationWidget::toggleAutoSynchronization); &FolderNavigationWidget::toggleAutoSynchronization);
connect(m_toggleRootSync, &QAbstractButton::clicked, connect(m_toggleRootSync, &QAbstractButton::clicked,
this, [this]() { setRootAutoSynchronization(!m_rootAutoSync); }); this, [this] { setRootAutoSynchronization(!m_rootAutoSync); });
connect(m_rootSelector, connect(m_rootSelector, &QComboBox::currentIndexChanged, this, [this](int index) {
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
[this](int index) {
const auto directory = m_rootSelector->itemData(index).value<Utils::FilePath>(); const auto directory = m_rootSelector->itemData(index).value<Utils::FilePath>();
m_rootSelector->setToolTip(directory.toUserOutput()); m_rootSelector->setToolTip(directory.toUserOutput());
setRootDirectory(directory); setRootDirectory(directory);

View File

@@ -109,7 +109,7 @@ Locator::Locator()
{ {
m_instance = this; m_instance = this;
m_refreshTimer.setSingleShot(false); m_refreshTimer.setSingleShot(false);
connect(&m_refreshTimer, &QTimer::timeout, this, [this]() { refresh(filters()); }); connect(&m_refreshTimer, &QTimer::timeout, this, [this] { refresh(filters()); });
} }
Locator::~Locator() Locator::~Locator()

View File

@@ -207,7 +207,7 @@ public:
connect(m_ui.filterList, &Utils::TreeView::activated, connect(m_ui.filterList, &Utils::TreeView::activated,
this, &LocatorSettingsWidget::configureFilter); this, &LocatorSettingsWidget::configureFilter);
connect(m_ui.editButton, &QPushButton::clicked, connect(m_ui.editButton, &QPushButton::clicked,
this, [this]() { configureFilter(m_ui.filterList->currentIndex()); }); this, [this] { configureFilter(m_ui.filterList->currentIndex()); });
connect(m_ui.removeButton, &QPushButton::clicked, connect(m_ui.removeButton, &QPushButton::clicked,
this, &LocatorSettingsWidget::removeCustomFilter); this, &LocatorSettingsWidget::removeCustomFilter);

View File

@@ -630,7 +630,8 @@ LocatorWidget::LocatorWidget(Locator *locator) :
m_progressIndicator->hide(); m_progressIndicator->hide();
m_showProgressTimer.setSingleShot(true); m_showProgressTimer.setSingleShot(true);
m_showProgressTimer.setInterval(50); // don't show progress for < 50ms tasks m_showProgressTimer.setInterval(50); // don't show progress for < 50ms tasks
connect(&m_showProgressTimer, &QTimer::timeout, [this]() { setProgressIndicatorVisible(true);}); connect(&m_showProgressTimer, &QTimer::timeout,
this, [this] { setProgressIndicatorVisible(true); });
Command *locateCmd = ActionManager::command(Constants::LOCATE); Command *locateCmd = ActionManager::command(Constants::LOCATE);
if (QTC_GUARD(locateCmd)) { if (QTC_GUARD(locateCmd)) {

View File

@@ -564,7 +564,7 @@ void LoggingViewManagerWidget::showLogViewContextMenu(const QPoint &pos) const
m.addAction(copy); m.addAction(copy);
auto copyAll = new QAction(tr("Copy All"), &m); auto copyAll = new QAction(tr("Copy All"), &m);
m.addAction(copyAll); m.addAction(copyAll);
connect(copy, &QAction::triggered, &m, [this](){ connect(copy, &QAction::triggered, &m, [this] {
auto selectionModel = m_logView->selectionModel(); auto selectionModel = m_logView->selectionModel();
QString copied; QString copied;
const bool useTS = m_timestamps->isChecked(); const bool useTS = m_timestamps->isChecked();
@@ -576,7 +576,7 @@ void LoggingViewManagerWidget::showLogViewContextMenu(const QPoint &pos) const
QGuiApplication::clipboard()->setText(copied); QGuiApplication::clipboard()->setText(copied);
}); });
connect(copyAll, &QAction::triggered, &m, [this](){ connect(copyAll, &QAction::triggered, &m, [this] {
QString copied; QString copied;
const bool useTS = m_timestamps->isChecked(); const bool useTS = m_timestamps->isChecked();
const bool useLL = m_messageTypes->isChecked(); const bool useLL = m_messageTypes->isChecked();

View File

@@ -1493,7 +1493,7 @@ void MainWindow::changeLog()
"[\\1](https://bugreports.qt.io/browse/\\1)"); "[\\1](https://bugreports.qt.io/browse/\\1)");
textEdit->setMarkdown(contents); textEdit->setMarkdown(contents);
}; };
connect(versionCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), textEdit, showLog); connect(versionCombo, &QComboBox::currentIndexChanged, textEdit, showLog);
showLog(versionCombo->currentIndex()); showLog(versionCombo->currentIndex());
connect(showInExplorer, &QPushButton::clicked, [versionCombo, versionedFiles] { connect(showInExplorer, &QPushButton::clicked, [versionCombo, versionedFiles] {

View File

@@ -55,8 +55,7 @@ MimeTypeMagicDialog::MimeTypeMagicDialog(QWidget *parent) :
connect(ui.informationLabel, &QLabel::linkActivated, this, [](const QString &link) { connect(ui.informationLabel, &QLabel::linkActivated, this, [](const QString &link) {
QDesktopServices::openUrl(QUrl(link)); QDesktopServices::openUrl(QUrl(link));
}); });
connect(ui.typeSelector, QOverload<int>::of(&QComboBox::activated), connect(ui.typeSelector, &QComboBox::activated, this, [this] {
this, [this]() {
if (ui.useRecommendedGroupBox->isChecked()) if (ui.useRecommendedGroupBox->isChecked())
setToRecommendedValues(); setToRecommendedValues();
}); });

View File

@@ -99,8 +99,7 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget, int pos
setFactoryIndex(factoryIndex); setFactoryIndex(factoryIndex);
connect(m_navigationComboBox, connect(m_navigationComboBox, &QComboBox::currentIndexChanged,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &NavigationSubWidget::comboBoxIndexChanged); this, &NavigationSubWidget::comboBoxIndexChanged);
comboBoxIndexChanged(factoryIndex); comboBoxIndexChanged(factoryIndex);

View File

@@ -99,8 +99,7 @@ SideBarWidget::SideBarWidget(SideBar *sideBar, const QString &id)
} }
setCurrentItem(t); setCurrentItem(t);
connect(m_comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(m_comboBox, &QComboBox::currentIndexChanged, this, &SideBarWidget::setCurrentIndex);
this, &SideBarWidget::setCurrentIndex);
} }
SideBarWidget::~SideBarWidget() = default; SideBarWidget::~SideBarWidget() = default;

View File

@@ -94,13 +94,10 @@ public:
for (const TerminalCommand &term : availableTerminals) for (const TerminalCommand &term : availableTerminals)
m_ui.terminalComboBox->addItem(term.command, QVariant::fromValue(term)); m_ui.terminalComboBox->addItem(term.command, QVariant::fromValue(term));
updateTerminalUi(TerminalCommand::terminalEmulator()); updateTerminalUi(TerminalCommand::terminalEmulator());
connect(m_ui.terminalComboBox, connect(m_ui.terminalComboBox, &QComboBox::currentIndexChanged, this,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
[this](int index) { [this](int index) {
updateTerminalUi( updateTerminalUi(m_ui.terminalComboBox->itemData(index).value<TerminalCommand>());
m_ui.terminalComboBox->itemData(index).value<TerminalCommand>()); });
});
} else { } else {
m_ui.terminalLabel->hide(); m_ui.terminalLabel->hide();
m_ui.terminalComboBox->hide(); m_ui.terminalComboBox->hide();
@@ -156,8 +153,7 @@ public:
connect(m_ui.helpCrashReportingButton, &QAbstractButton::clicked, this, [this] { connect(m_ui.helpCrashReportingButton, &QAbstractButton::clicked, this, [this] {
showHelpDialog(tr("Crash Reporting"), CorePlugin::msgCrashpadInformation()); showHelpDialog(tr("Crash Reporting"), CorePlugin::msgCrashpadInformation());
}); });
connect(m_ui.enableCrashReportingCheckBox, connect(m_ui.enableCrashReportingCheckBox, &QCheckBox::stateChanged, this, [this] {
QOverload<int>::of(&QCheckBox::stateChanged), this, [this] {
const QString restartText = tr("The change will take effect after restart."); const QString restartText = tr("The change will take effect after restart.");
Core::RestartDialog restartDialog(Core::ICore::dialogParent(), restartText); Core::RestartDialog restartDialog(Core::ICore::dialogParent(), restartText);
restartDialog.exec(); restartDialog.exec();

View File

@@ -90,7 +90,7 @@ WindowSupport::WindowSupport(QWidget *window, const Context &context)
m_windowList->addWindow(window); m_windowList->addWindow(window);
connect(ICore::instance(), &ICore::coreAboutToClose, this, [this]() { m_shutdown = true; }); connect(ICore::instance(), &ICore::coreAboutToClose, this, [this] { m_shutdown = true; });
} }
WindowSupport::~WindowSupport() WindowSupport::~WindowSupport()