forked from qt-creator/qt-creator
Drop Qt5: Cpp/TextEditor: Get rid of QOverload
Change-Id: I010f211b40f876c0f033fd717aaa094f775ea214 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -291,7 +291,7 @@ void ClangDiagnosticConfigsWidget::sync()
|
||||
return;
|
||||
|
||||
disconnectClangOnlyOptionsChanged();
|
||||
Utils::ExecuteOnDestruction e([this]() { connectClangOnlyOptionsChanged(); });
|
||||
Utils::ExecuteOnDestruction e([this] { connectClangOnlyOptionsChanged(); });
|
||||
|
||||
// Update main button row
|
||||
const ClangDiagnosticConfig &config = currentConfig();
|
||||
|
@@ -1386,8 +1386,7 @@ CppCodeModelInspectorDialog::CppCodeModelInspectorDialog(QWidget *parent)
|
||||
this, &CppCodeModelInspectorDialog::onDocumentSelected);
|
||||
connect(m_snapshotView, &FilterableView::filterChanged,
|
||||
this, &CppCodeModelInspectorDialog::onSnapshotFilterChanged);
|
||||
connect(m_ui->snapshotSelector,
|
||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
connect(m_ui->snapshotSelector, &QComboBox::currentIndexChanged,
|
||||
this, &CppCodeModelInspectorDialog::onSnapshotSelected);
|
||||
connect(m_ui->docSymbolsView, &QTreeView::expanded,
|
||||
this, &CppCodeModelInspectorDialog::onSymbolsViewExpandedOrCollapsed);
|
||||
|
@@ -390,13 +390,13 @@ ClangdSettingsWidget::ClangdSettingsWidget(const ClangdSettings::Data &settingsD
|
||||
this, &ClangdSettingsWidget::settingsDataChanged);
|
||||
connect(&d->autoIncludeHeadersCheckBox, &QCheckBox::toggled,
|
||||
this, &ClangdSettingsWidget::settingsDataChanged);
|
||||
connect(&d->threadLimitSpinBox, qOverload<int>(&QSpinBox::valueChanged),
|
||||
connect(&d->threadLimitSpinBox, &QSpinBox::valueChanged,
|
||||
this, &ClangdSettingsWidget::settingsDataChanged);
|
||||
connect(&d->sizeThresholdCheckBox, &QCheckBox::toggled,
|
||||
this, &ClangdSettingsWidget::settingsDataChanged);
|
||||
connect(&d->sizeThresholdSpinBox, qOverload<int>(&QSpinBox::valueChanged),
|
||||
connect(&d->sizeThresholdSpinBox, &QSpinBox::valueChanged,
|
||||
this, &ClangdSettingsWidget::settingsDataChanged);
|
||||
connect(&d->documentUpdateThreshold, qOverload<int>(&QSpinBox::valueChanged),
|
||||
connect(&d->documentUpdateThreshold, &QSpinBox::valueChanged,
|
||||
this, &ClangdSettingsWidget::settingsDataChanged);
|
||||
connect(&d->clangdChooser, &Utils::PathChooser::filePathChanged,
|
||||
this, &ClangdSettingsWidget::settingsDataChanged);
|
||||
|
@@ -123,10 +123,8 @@ CppEditorOutline::CppEditorOutline(TextEditor::TextEditorWidget *editorWidget)
|
||||
&CppToolsSettings::setSortedEditorDocumentOutline);
|
||||
m_combo->addAction(m_sortAction);
|
||||
|
||||
connect(m_combo, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &CppEditorOutline::gotoSymbolInEditor);
|
||||
connect(m_combo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &CppEditorOutline::updateToolTip);
|
||||
connect(m_combo, &QComboBox::activated, this, &CppEditorOutline::gotoSymbolInEditor);
|
||||
connect(m_combo, &QComboBox::currentIndexChanged, this, &CppEditorOutline::updateToolTip);
|
||||
|
||||
// Set up timers
|
||||
m_updateTimer = newSingleShotTimer(this, UpdateOutlineIntervalInMs,
|
||||
|
@@ -513,7 +513,7 @@ void CppEditorWidget::finalizeInitialization()
|
||||
connect(this, &QPlainTextEdit::textChanged, this, &CppEditorWidget::updateFunctionDeclDefLink);
|
||||
|
||||
// set up the use highlighitng
|
||||
connect(this, &CppEditorWidget::cursorPositionChanged, this, [this]() {
|
||||
connect(this, &CppEditorWidget::cursorPositionChanged, this, [this] {
|
||||
if (!d->m_localRenaming.isActive())
|
||||
d->m_useSelectionsUpdater.scheduleUpdate();
|
||||
|
||||
@@ -1182,7 +1182,7 @@ AssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistR
|
||||
? qobject_cast<CppCompletionAssistProvider *>(cppEditorDocument()->completionAssistProvider())
|
||||
: qobject_cast<CppCompletionAssistProvider *>(cppEditorDocument()->functionHintAssistProvider());
|
||||
|
||||
auto getFeatures = [this]() {
|
||||
auto getFeatures = [this] {
|
||||
LanguageFeatures features = LanguageFeatures::defaultFeatures();
|
||||
if (Document::Ptr doc = d->m_lastSemanticInfo.doc)
|
||||
features = doc->languageFeatures();
|
||||
|
@@ -1070,7 +1070,7 @@ void InsertVirtualMethodsDialog::initGui()
|
||||
auto clearUserAddedReplacements = new QAction(this);
|
||||
clearUserAddedReplacements->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
|
||||
clearUserAddedReplacements->setText(tr("Clear Added \"override\" Equivalents"));
|
||||
connect(clearUserAddedReplacements, &QAction::triggered, [this]() {
|
||||
connect(clearUserAddedReplacements, &QAction::triggered, [this] {
|
||||
m_availableOverrideReplacements = defaultOverrideReplacements();
|
||||
updateOverrideReplacementsComboBox();
|
||||
m_clearUserAddedReplacementsButton->setEnabled(false);
|
||||
|
@@ -144,16 +144,13 @@ ParseContextWidget::ParseContextWidget(ParseContextModel &parseContextModel, QWi
|
||||
// Set up context menu with a clear action
|
||||
setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
m_clearPreferredAction = new QAction(tr("Clear Preferred Parse Context"), this);
|
||||
connect(m_clearPreferredAction, &QAction::triggered, this, [this]() {
|
||||
connect(m_clearPreferredAction, &QAction::triggered, this, [this] {
|
||||
m_parseContextModel.clearPreferred();
|
||||
});
|
||||
addAction(m_clearPreferredAction);
|
||||
|
||||
// Set up sync of this widget and model in both directions
|
||||
connect(this,
|
||||
QOverload<int>::of(&QComboBox::activated),
|
||||
&m_parseContextModel,
|
||||
&ParseContextModel::setPreferred);
|
||||
connect(this, &QComboBox::activated, &m_parseContextModel, &ParseContextModel::setPreferred);
|
||||
connect(&m_parseContextModel, &ParseContextModel::updated,
|
||||
this, &ParseContextWidget::syncToModel);
|
||||
|
||||
|
@@ -3138,7 +3138,7 @@ public:
|
||||
if (!implFile.isEmpty())
|
||||
implTargetStrings.append(implFile.fileName());
|
||||
defaultImplTargetComboBox->insertItems(0, implTargetStrings);
|
||||
connect(defaultImplTargetComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
connect(defaultImplTargetComboBox, &QComboBox::currentIndexChanged, this,
|
||||
[this](int index) {
|
||||
for (int i = 0; i < m_implTargetBoxes.size(); ++i) {
|
||||
if (!m_candidates.at(i)->type()->asFunctionType()->isPureVirtual())
|
||||
@@ -8762,7 +8762,7 @@ public:
|
||||
|
||||
using A = InsertionPointLocator::AccessSpec;
|
||||
auto accessCombo = new QComboBox;
|
||||
connect(accessCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this, accessCombo]() {
|
||||
connect(accessCombo, &QComboBox::currentIndexChanged, this, [this, accessCombo] {
|
||||
const auto data = accessCombo->currentData();
|
||||
m_accessSpec = static_cast<A>(data.toInt());
|
||||
});
|
||||
|
@@ -47,7 +47,7 @@ CppUseSelectionsUpdater::CppUseSelectionsUpdater(CppEditorWidget *editorWidget)
|
||||
{
|
||||
m_timer.setSingleShot(true);
|
||||
m_timer.setInterval(updateUseSelectionsInternalInMs);
|
||||
connect(&m_timer, &QTimer::timeout, this, [this]() { update(); });
|
||||
connect(&m_timer, &QTimer::timeout, this, [this] { update(); });
|
||||
}
|
||||
|
||||
CppUseSelectionsUpdater::~CppUseSelectionsUpdater()
|
||||
|
@@ -200,7 +200,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
|
||||
bool isUpdate)
|
||||
{
|
||||
// make sure to cleanup old proposals if we cannot find a new assistant
|
||||
Utils::ExecuteOnDestruction earlyReturnContextClear([this]() { destroyContext(); });
|
||||
Utils::ExecuteOnDestruction earlyReturnContextClear([this] { destroyContext(); });
|
||||
if (isWaitingForProposal())
|
||||
cancelCurrentRequest();
|
||||
|
||||
|
@@ -154,7 +154,7 @@ FunctionHintProposalWidget::FunctionHintProposalWidget()
|
||||
|
||||
connect(upArrow, &QAbstractButton::clicked, this, &FunctionHintProposalWidget::previousPage);
|
||||
connect(downArrow, &QAbstractButton::clicked, this, &FunctionHintProposalWidget::nextPage);
|
||||
connect(d->m_popupFrame.data(), &QObject::destroyed, this, [this](){
|
||||
connect(d->m_popupFrame.data(), &QObject::destroyed, this, [this] {
|
||||
qApp->removeEventFilter(this);
|
||||
deleteLater();
|
||||
});
|
||||
|
@@ -153,8 +153,8 @@ QWidget *FindInFiles::createConfigWidget()
|
||||
auto searchEngineLabel = new QLabel(tr("Search engine:"));
|
||||
gridLayout->addWidget(searchEngineLabel, row, 0, Qt::AlignRight);
|
||||
m_searchEngineCombo = new QComboBox;
|
||||
auto cc = QOverload<int>::of(&QComboBox::currentIndexChanged);
|
||||
connect(m_searchEngineCombo, cc, this, &FindInFiles::searchEnginesSelectionChanged);
|
||||
connect(m_searchEngineCombo, &QComboBox::currentIndexChanged,
|
||||
this, &FindInFiles::searchEnginesSelectionChanged);
|
||||
searchEngineLabel->setBuddy(m_searchEngineCombo);
|
||||
gridLayout->addWidget(m_searchEngineCombo, row, 1);
|
||||
|
||||
@@ -194,7 +194,7 @@ QWidget *FindInFiles::createConfigWidget()
|
||||
m_configWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
|
||||
// validity
|
||||
auto updateValidity = [this]() {
|
||||
auto updateValidity = [this] {
|
||||
setValid(currentSearchEngine()->isEnabled() && m_directory->isValid());
|
||||
};
|
||||
connect(this, &BaseFileFind::currentSearchEngineChanged, this, updateValidity);
|
||||
|
@@ -353,7 +353,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
|
||||
connect(m_model, &QAbstractItemModel::modelReset,
|
||||
this, &SnippetsSettingsPagePrivate::markSnippetsCollection);
|
||||
|
||||
connect(m_ui.groupCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
connect(m_ui.groupCombo, &QComboBox::currentIndexChanged,
|
||||
this, &SnippetsSettingsPagePrivate::loadSnippetGroup);
|
||||
connect(m_ui.addButton, &QAbstractButton::clicked,
|
||||
this, &SnippetsSettingsPagePrivate::addSnippet);
|
||||
|
@@ -864,7 +864,7 @@ void TextEditorWidgetFind::selectAll(const QString &txt, FindFlags findFlags)
|
||||
|
||||
m_selectWatcher = new QFutureWatcher<FileSearchResultList>();
|
||||
connect(m_selectWatcher, &QFutureWatcher<Utils::FileSearchResultList>::finished,
|
||||
this, [this]() {
|
||||
this, [this] {
|
||||
const QFuture<FileSearchResultList> future = m_selectWatcher->future();
|
||||
m_selectWatcher->deleteLater();
|
||||
m_selectWatcher = nullptr;
|
||||
@@ -1214,7 +1214,7 @@ void TextEditorWidgetPrivate::ctor(const QSharedPointer<TextDocument> &doc)
|
||||
q, &TextEditorWidget::updateTextCodecLabel);
|
||||
q->updateTextCodecLabel();
|
||||
|
||||
connect(m_fileLineEnding, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
connect(m_fileLineEnding, &QComboBox::currentIndexChanged,
|
||||
q, &TextEditorWidget::selectLineEnding);
|
||||
connect(m_document->document(), &QTextDocument::modificationChanged,
|
||||
q, &TextEditorWidget::updateTextLineEndingLabel);
|
||||
@@ -1611,7 +1611,7 @@ void TextEditorWidgetPrivate::updateCannotDecodeInfo()
|
||||
InfoBarEntry info(selectEncodingId,
|
||||
TextEditorWidget::tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
|
||||
.arg(m_document->displayName(), QString::fromLatin1(m_document->codec()->name())));
|
||||
info.addCustomButton(TextEditorWidget::tr("Select Encoding"), [this]() { q->selectEncoding(); });
|
||||
info.addCustomButton(TextEditorWidget::tr("Select Encoding"), [this] { q->selectEncoding(); });
|
||||
infoBar->addInfo(info);
|
||||
} else {
|
||||
infoBar->removeInfo(selectEncodingId);
|
||||
@@ -3484,8 +3484,7 @@ void TextEditorWidgetPrivate::setupDocumentSignals()
|
||||
QObject::connect(m_document.data(), &TextDocument::reloadFinished,
|
||||
this, &TextEditorWidgetPrivate::documentReloadFinished);
|
||||
|
||||
QObject::connect(m_document.data(), &TextDocument::tabSettingsChanged,
|
||||
this, [this](){
|
||||
QObject::connect(m_document.data(), &TextDocument::tabSettingsChanged, this, [this] {
|
||||
updateTabStops();
|
||||
m_autoCompleter->setTabSettings(m_document->tabSettings());
|
||||
});
|
||||
@@ -5240,7 +5239,7 @@ void TextEditorWidgetPrivate::updateHighlights()
|
||||
}
|
||||
|
||||
if (m_highlightAutoComplete && !m_autoCompleteHighlightPos.isEmpty()) {
|
||||
QMetaObject::invokeMethod(this, [this]() {
|
||||
QMetaObject::invokeMethod(this, [this] {
|
||||
const QTextCursor &cursor = q->textCursor();
|
||||
auto popAutoCompletion = [&]() {
|
||||
return !m_autoCompleteHighlightPos.isEmpty()
|
||||
@@ -8047,7 +8046,7 @@ bool TextEditorWidget::inFindScope(const QTextCursor &cursor) const
|
||||
|
||||
void TextEditorWidget::updateVisualWrapColumn()
|
||||
{
|
||||
auto calcMargin = [this]() {
|
||||
auto calcMargin = [this] {
|
||||
const auto &ms = d->m_marginSettings;
|
||||
|
||||
if (!ms.m_showMargin) {
|
||||
|
Reference in New Issue
Block a user