Replace static_casts by QOverload where possible

Mainly to get rid of the QProcess::finished deprecation warning.

Also adjust coding style in the surrounding connects when needed.

Change-Id: I12f9b248c7974b892c4a069356e578e80f8c59e9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-02-26 09:40:49 +01:00
parent 44a42db1ae
commit 6f37348b4c
136 changed files with 225 additions and 253 deletions

View File

@@ -296,7 +296,7 @@ bool AndroidAvdManager::startAvdAsync(const QString &avdName) const
auto avdProcess = new QProcess();
avdProcess->setProcessChannelMode(QProcess::MergedChannels);
QObject::connect(avdProcess,
static_cast<void (QProcess::*)(int)>(&QProcess::finished),
QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
avdProcess,
std::bind(&avdProcessFinished, std::placeholders::_1, avdProcess));

View File

@@ -100,7 +100,7 @@ AndroidBuildApkInnerWidget::AndroidBuildApkInnerWidget(AndroidBuildApkStep *step
// target sdk
connect(m_ui->targetSDKComboBox,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
QOverload<const QString &>::of(&QComboBox::activated),
this, &AndroidBuildApkInnerWidget::setTargetSdk);
// deployment options
@@ -122,10 +122,10 @@ AndroidBuildApkInnerWidget::AndroidBuildApkInnerWidget(AndroidBuildApkStep *step
connect(m_ui->KeystoreLocationPathChooser, &Utils::PathChooser::pathChanged,
this, &AndroidBuildApkInnerWidget::updateKeyStorePath);
connect(m_ui->certificatesAliasComboBox,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
QOverload<const QString &>::of(&QComboBox::activated),
this, &AndroidBuildApkInnerWidget::certificatesAliasComboBoxActivated);
connect(m_ui->certificatesAliasComboBox,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
this, &AndroidBuildApkInnerWidget::certificatesAliasComboBoxCurrentIndexChanged);
connect(m_step->buildConfiguration(), &ProjectExplorer::BuildConfiguration::buildTypeChanged,

View File

@@ -666,7 +666,7 @@ QProcess *AndroidManager::runAdbCommandDetached(const QStringList &args, QString
p->start(adb, args);
if (p->waitForStarted(500) && p->state() == QProcess::Running) {
if (deleteOnFinish) {
connect(p.get(), static_cast<void (QProcess::*)(int)>(&QProcess::finished),
connect(p.get(), QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
p.get(), &QObject::deleteLater);
}
return p.release();

View File

@@ -202,10 +202,10 @@ void AndroidManifestEditorWidget::initializePage()
connect(m_versionNameLinedit, &QLineEdit::textEdited,
this, setDirtyFunc);
connect(m_androidMinSdkVersion,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, setDirtyFunc);
connect(m_androidTargetSdkVersion,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, setDirtyFunc);
}

View File

@@ -63,8 +63,7 @@ void Android::Internal::AndroidSignalOperation::adbFindRunAsFinished(int exitCod
m_state = Idle;
emit finished(m_errorMessage);
} else {
connect(m_adbProcess,
static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
connect(m_adbProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &AndroidSignalOperation::adbKillFinished);
m_state = Kill;
m_timeout->start();
@@ -113,8 +112,7 @@ void Android::Internal::AndroidSignalOperation::signalOperationViaADB(qint64 pid
m_adbProcess->disconnect(this);
m_pid = pid;
m_signal = signal;
connect(m_adbProcess,
static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
connect(m_adbProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &AndroidSignalOperation::adbFindRunAsFinished);
m_state = RunAs;
m_timeout->start();

View File

@@ -66,7 +66,7 @@ AvdDialog::AvdDialog(int minApiLevel, AndroidSdkManager *sdkManager, const QStri
updateApiLevelComboBox();
connect(m_avdDialog.abiComboBox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &AvdDialog::updateApiLevelComboBox);
connect(&m_hideTipTimer, &QTimer::timeout,

View File

@@ -95,7 +95,7 @@ ChooseProFilePage::ChooseProFilePage(CreateAndroidManifestWizard *wizard)
}
nodeSelected(m_comboBox->currentIndex());
connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(m_comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &ChooseProFilePage::nodeSelected);
fl->addRow(tr(".pro file:"), m_comboBox);