Solve some clazy warnings

My last patch triggered me to run clazy on the project. This patch
solves some of them:
- Proper iteration of some types, saving their copy.
- compile-time connects
- prefer using connects with the 3rd argument as an object when using
lambdas.
This commit is contained in:
Aleix Pol 2020-07-01 04:07:33 +02:00 committed by Aleix Pol Gonzalez
parent f93c8769ef
commit c3259fc2df
4 changed files with 6 additions and 7 deletions

View File

@ -26,7 +26,7 @@ ToolTipDialog::ToolTipDialog(QQuickItem *parent)
m_showTimer = new QTimer(this);
m_showTimer->setSingleShot(true);
connect(m_showTimer, &QTimer::timeout, [ = ]() {
connect(m_showTimer, &QTimer::timeout, this, [this]() {
setVisible(false);
});
}

View File

@ -121,9 +121,8 @@ PluginLoader::PluginLoader()
PluginLoader::~PluginLoader()
{
typedef QPointer<PackageStructure> pswp;
for (pswp wp : qAsConst(d->structures)) {
delete wp.data();
for (const auto &wp : qAsConst(d->structures)) {
delete wp;
}
delete d;
}

View File

@ -596,7 +596,7 @@ void AppletQuickItem::init()
reason = d->applet->launchErrorMessage();
} else if (d->applet->kPackage().isValid()) {
const auto errors = d->qmlObject->mainComponent()->errors();
for (QQmlError error : errors) {
for (const QQmlError &error : errors) {
reason += error.toString() + QLatin1Char('\n');
}
reason = i18n("Error loading QML file: %1", reason);

View File

@ -482,8 +482,8 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y, KI
job->setParent(m_dropMenu.data());
QObject::connect(job, &KJob::result, this, &ContainmentInterface::dropJobResult);
QObject::connect(job, SIGNAL(mimetype(KIO::Job*, QString)),
this, SLOT(mimeTypeRetrieved(KIO::Job*,QString)));
QObject::connect(job, QOverload<KIO::Job *, const QString &>::of(&KIO::MimetypeJob::mimetype),
this, &ContainmentInterface::mimeTypeRetrieved);
} else {
bool deleteDropMenu = true;