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 = new QTimer(this);
m_showTimer->setSingleShot(true); m_showTimer->setSingleShot(true);
connect(m_showTimer, &QTimer::timeout, [ = ]() { connect(m_showTimer, &QTimer::timeout, this, [this]() {
setVisible(false); setVisible(false);
}); });
} }

View File

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

View File

@ -596,7 +596,7 @@ void AppletQuickItem::init()
reason = d->applet->launchErrorMessage(); reason = d->applet->launchErrorMessage();
} else if (d->applet->kPackage().isValid()) { } else if (d->applet->kPackage().isValid()) {
const auto errors = d->qmlObject->mainComponent()->errors(); const auto errors = d->qmlObject->mainComponent()->errors();
for (QQmlError error : errors) { for (const QQmlError &error : errors) {
reason += error.toString() + QLatin1Char('\n'); reason += error.toString() + QLatin1Char('\n');
} }
reason = i18n("Error loading QML file: %1", reason); 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()); job->setParent(m_dropMenu.data());
QObject::connect(job, &KJob::result, this, &ContainmentInterface::dropJobResult); QObject::connect(job, &KJob::result, this, &ContainmentInterface::dropJobResult);
QObject::connect(job, SIGNAL(mimetype(KIO::Job*, QString)), QObject::connect(job, QOverload<KIO::Job *, const QString &>::of(&KIO::MimetypeJob::mimetype),
this, SLOT(mimeTypeRetrieved(KIO::Job*,QString))); this, &ContainmentInterface::mimeTypeRetrieved);
} else { } else {
bool deleteDropMenu = true; bool deleteDropMenu = true;