Drop Qt5: Utils: Get rid of QOverload

Change-Id: I864bfb18668fd325badd34003adf494c7924f86b
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Jarek Kobus
2022-07-19 22:32:39 +02:00
parent d7b248baec
commit 74ea4dc07d
10 changed files with 19 additions and 32 deletions

View File

@@ -1507,10 +1507,10 @@ void SelectionAspect::addToLayout(LayoutBuilder &builder)
for (int i = 0, n = d->m_options.size(); i < n; ++i) for (int i = 0, n = d->m_options.size(); i < n; ++i)
d->m_comboBox->addItem(d->m_options.at(i).displayName); d->m_comboBox->addItem(d->m_options.at(i).displayName);
if (isAutoApply()) { if (isAutoApply()) {
connect(d->m_comboBox.data(), QOverload<int>::of(&QComboBox::activated), connect(d->m_comboBox.data(), &QComboBox::activated,
this, &SelectionAspect::setValue); this, &SelectionAspect::setValue);
} }
connect(d->m_comboBox.data(), QOverload<int>::of(&QComboBox::currentIndexChanged), connect(d->m_comboBox.data(), &QComboBox::currentIndexChanged,
this, &SelectionAspect::volatileValueChanged); this, &SelectionAspect::volatileValueChanged);
d->m_comboBox->setCurrentIndex(value()); d->m_comboBox->setCurrentIndex(value());
addLabeledItem(builder, d->m_comboBox); addLabeledItem(builder, d->m_comboBox);
@@ -1799,7 +1799,7 @@ void IntegerAspect::addToLayout(LayoutBuilder &builder)
addLabeledItem(builder, d->m_spinBox); addLabeledItem(builder, d->m_spinBox);
if (isAutoApply()) { if (isAutoApply()) {
connect(d->m_spinBox.data(), QOverload<int>::of(&QSpinBox::valueChanged), connect(d->m_spinBox.data(), &QSpinBox::valueChanged,
this, [this] { setValue(d->m_spinBox->value()); }); this, [this] { setValue(d->m_spinBox->value()); });
} }
} }
@@ -1926,7 +1926,7 @@ void DoubleAspect::addToLayout(LayoutBuilder &builder)
addLabeledItem(builder, d->m_spinBox); addLabeledItem(builder, d->m_spinBox);
if (isAutoApply()) { if (isAutoApply()) {
connect(d->m_spinBox.data(), QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(d->m_spinBox.data(), &QDoubleSpinBox::valueChanged,
this, [this] { setValue(d->m_spinBox->value()); }); this, [this] { setValue(d->m_spinBox->value()); });
} }
} }

View File

@@ -347,7 +347,7 @@ bool DeviceShell::start()
qCWarning(deviceShellLog) << "Received unexpected output on stderr:" << stdErr; qCWarning(deviceShellLog) << "Received unexpected output on stderr:" << stdErr;
}); });
connect(m_shellProcess, &QtcProcess::done, m_shellProcess, [this]() { connect(m_shellProcess, &QtcProcess::done, m_shellProcess, [this] {
if (m_shellProcess->resultData().m_exitCode != EXIT_SUCCESS if (m_shellProcess->resultData().m_exitCode != EXIT_SUCCESS
|| m_shellProcess->resultData().m_exitStatus != QProcess::NormalExit) { || m_shellProcess->resultData().m_exitStatus != QProcess::NormalExit) {
qCWarning(deviceShellLog) << "Shell exited with error code:" qCWarning(deviceShellLog) << "Shell exited with error code:"

View File

@@ -270,14 +270,11 @@ DockWidget::DockWidget(QWidget *inner, FancyMainWindow *parent, bool immutable)
m_timer.setInterval(500); m_timer.setInterval(500);
connect(&m_timer, &QTimer::timeout, this, &DockWidget::handleMouseTimeout); connect(&m_timer, &QTimer::timeout, this, &DockWidget::handleMouseTimeout);
connect(this, &QDockWidget::topLevelChanged, this, &DockWidget::handleToplevelChanged); connect(this, &QDockWidget::topLevelChanged, this, &DockWidget::handleToplevelChanged);
connect(toggleViewAction(), &QAction::triggered, [this] {
connect(toggleViewAction(), &QAction::triggered, if (isVisible())
[this]() { raise();
if (isVisible()) });
raise();
});
auto origFloatButton = findChild<QAbstractButton *>(QLatin1String("qt_dockwidget_floatbutton")); auto origFloatButton = findChild<QAbstractButton *>(QLatin1String("qt_dockwidget_floatbutton"));
connect(m_titleBar->m_floatButton, &QAbstractButton::clicked, connect(m_titleBar->m_floatButton, &QAbstractButton::clicked,

View File

@@ -345,7 +345,7 @@ void InfoBarDisplay::update()
cb->addItem(comboInfo.displayText, comboInfo.data); cb->addItem(comboInfo.displayText, comboInfo.data);
if (info.m_combo.currentIndex >= 0 && info.m_combo.currentIndex < cb->count()) if (info.m_combo.currentIndex >= 0 && info.m_combo.currentIndex < cb->count())
cb->setCurrentIndex(info.m_combo.currentIndex); cb->setCurrentIndex(info.m_combo.currentIndex);
connect(cb, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [cb, info]() { connect(cb, &QComboBox::currentIndexChanged, this, [cb, info]() {
info.m_combo.callback({cb->currentText(), cb->currentData()}); info.m_combo.callback({cb->currentText(), cb->currentData()});
}, Qt::QueuedConnection); }, Qt::QueuedConnection);

View File

@@ -99,14 +99,9 @@ public:
void reap() void reap()
{ {
m_timer.start(); m_timer.start();
connect(m_reaperSetup.m_process, &QProcess::finished, this, &Reaper::handleFinished);
connect(m_reaperSetup.m_process,
QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &Reaper::handleFinished);
if (emitFinished()) if (emitFinished())
return; return;
terminate(); terminate();
} }

View File

@@ -94,7 +94,7 @@ static FilePath imageFileNameForIndicatorSize(ProgressIndicatorSize size)
ProgressIndicatorPainter::ProgressIndicatorPainter(ProgressIndicatorSize size) ProgressIndicatorPainter::ProgressIndicatorPainter(ProgressIndicatorSize size)
{ {
m_timer.setSingleShot(false); m_timer.setSingleShot(false);
QObject::connect(&m_timer, &QTimer::timeout, [this]() { QObject::connect(&m_timer, &QTimer::timeout, [this] {
nextAnimationStep(); nextAnimationStep();
if (m_callback) if (m_callback)
m_callback(); m_callback();
@@ -219,7 +219,7 @@ ProgressIndicator::ProgressIndicator(ProgressIndicatorSize size, QWidget *parent
{ {
setPaintFunction( setPaintFunction(
[this](QWidget *w, QPainter &p, QPaintEvent *) { m_paint.paint(p, w->rect()); }); [this](QWidget *w, QPainter &p, QPaintEvent *) { m_paint.paint(p, w->rect()); });
m_paint.setUpdateCallback([this]() { update(); }); m_paint.setUpdateCallback([this] { update(); });
updateGeometry(); updateGeometry();
} }

View File

@@ -92,8 +92,7 @@ ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
this, &ProjectIntroPage::slotActivated); this, &ProjectIntroPage::slotActivated);
connect(d->m_ui.nameLineEdit, &FancyLineEdit::validReturnPressed, connect(d->m_ui.nameLineEdit, &FancyLineEdit::validReturnPressed,
this, &ProjectIntroPage::slotActivated); this, &ProjectIntroPage::slotActivated);
connect(d->m_ui.projectComboBox, connect(d->m_ui.projectComboBox, &QComboBox::currentIndexChanged,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &ProjectIntroPage::slotChanged); this, &ProjectIntroPage::slotChanged);
setProperty(SHORT_TITLE_PROPERTY, tr("Location")); setProperty(SHORT_TITLE_PROPERTY, tr("Location"));

View File

@@ -353,12 +353,9 @@ public:
: m_process(new ProcessHelper(this)) : m_process(new ProcessHelper(this))
, m_blockingImpl(new QProcessBlockingImpl(m_process)) , m_blockingImpl(new QProcessBlockingImpl(m_process))
{ {
connect(m_process, &QProcess::started, connect(m_process, &QProcess::started, this, &QProcessImpl::handleStarted);
this, &QProcessImpl::handleStarted); connect(m_process, &QProcess::finished, this, &QProcessImpl::handleFinished);
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), connect(m_process, &QProcess::errorOccurred, this, &QProcessImpl::handleError);
this, &QProcessImpl::handleFinished);
connect(m_process, &QProcess::errorOccurred,
this, &QProcessImpl::handleError);
connect(m_process, &QProcess::readyReadStandardOutput, this, [this] { connect(m_process, &QProcess::readyReadStandardOutput, this, [this] {
emit readyRead(m_process->readAllStandardOutput(), {}); emit readyRead(m_process->readAllStandardOutput(), {});
}); });

View File

@@ -72,8 +72,7 @@ SettingsSelector::SettingsSelector(QWidget *parent) :
this, &SettingsSelector::removeButtonClicked); this, &SettingsSelector::removeButtonClicked);
connect(m_renameButton, &QAbstractButton::clicked, connect(m_renameButton, &QAbstractButton::clicked,
this, &SettingsSelector::renameButtonClicked); this, &SettingsSelector::renameButtonClicked);
connect(m_configurationCombo, connect(m_configurationCombo, &QComboBox::currentIndexChanged,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &SettingsSelector::currentChanged); this, &SettingsSelector::currentChanged);
} }

View File

@@ -43,7 +43,7 @@ TextFieldComboBox::TextFieldComboBox(QWidget *parent) :
QComboBox(parent) QComboBox(parent)
{ {
setEditable(false); setEditable(false);
connect(this, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(this, &QComboBox::currentIndexChanged,
this, &TextFieldComboBox::slotCurrentIndexChanged); this, &TextFieldComboBox::slotCurrentIndexChanged);
} }