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)
d->m_comboBox->addItem(d->m_options.at(i).displayName);
if (isAutoApply()) {
connect(d->m_comboBox.data(), QOverload<int>::of(&QComboBox::activated),
connect(d->m_comboBox.data(), &QComboBox::activated,
this, &SelectionAspect::setValue);
}
connect(d->m_comboBox.data(), QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(d->m_comboBox.data(), &QComboBox::currentIndexChanged,
this, &SelectionAspect::volatileValueChanged);
d->m_comboBox->setCurrentIndex(value());
addLabeledItem(builder, d->m_comboBox);
@@ -1799,7 +1799,7 @@ void IntegerAspect::addToLayout(LayoutBuilder &builder)
addLabeledItem(builder, d->m_spinBox);
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()); });
}
}
@@ -1926,7 +1926,7 @@ void DoubleAspect::addToLayout(LayoutBuilder &builder)
addLabeledItem(builder, d->m_spinBox);
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()); });
}
}

View File

@@ -347,7 +347,7 @@ bool DeviceShell::start()
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
|| m_shellProcess->resultData().m_exitStatus != QProcess::NormalExit) {
qCWarning(deviceShellLog) << "Shell exited with error code:"

View File

@@ -270,11 +270,8 @@ DockWidget::DockWidget(QWidget *inner, FancyMainWindow *parent, bool immutable)
m_timer.setInterval(500);
connect(&m_timer, &QTimer::timeout, this, &DockWidget::handleMouseTimeout);
connect(this, &QDockWidget::topLevelChanged, this, &DockWidget::handleToplevelChanged);
connect(toggleViewAction(), &QAction::triggered,
[this]() {
connect(toggleViewAction(), &QAction::triggered, [this] {
if (isVisible())
raise();
});

View File

@@ -345,7 +345,7 @@ void InfoBarDisplay::update()
cb->addItem(comboInfo.displayText, comboInfo.data);
if (info.m_combo.currentIndex >= 0 && info.m_combo.currentIndex < cb->count())
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()});
}, Qt::QueuedConnection);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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