fixed some Clazy `level0` warnings (#5344)

Regarding the "normalized signatures" see
https://github.com/KDE/clazy/blob/master/docs/checks/README-connect-not-normalized.md
and https://doc.qt.io/qt-6/qmetaobject.html#normalizedSignature.
This commit is contained in:
Oliver Stöneberg 2023-08-22 12:01:30 +02:00 committed by GitHub
parent 59c3bd22e6
commit f91df64fec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 52 deletions

View File

@ -185,7 +185,7 @@ void ApplicationList::clear()
bool ApplicationList::checkAndAddApplication(const QString& appPath, const QString& name, const QString& parameters)
{
if (QFileInfo(appPath).exists() && QFileInfo(appPath).isExecutable()) {
if (QFileInfo::exists(appPath) && QFileInfo(appPath).isExecutable()) {
Application app;
app.setName(name);
app.setPath("\"" + appPath + "\"");

View File

@ -172,38 +172,38 @@ StyleEditDialog::StyleEditDialog(const CodeEditorStyle& newStyle,
this, SLOT(setStyleDefaultLight()));
connect(mBtnDefaultDark, SIGNAL(clicked()),
this, SLOT(setStyleDefaultDark()));
connect(mBtnWidgetColorFG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedWidgetFG(const QColor&)));
connect(mBtnWidgetColorBG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedWidgetBG(const QColor&)));
connect(mBtnHighlightBG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedHighlightBG(const QColor&)));
connect(mBtnLineNumFG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedLineNumFG(const QColor&)));
connect(mBtnLineNumBG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedLineNumBG(const QColor&)));
connect(mBtnKeywordFG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedKeywordFG(const QColor&)));
connect(mCBKeywordWeight, SIGNAL(weightChanged(const QFont::Weight&)),
this, SLOT(weightChangedKeyword(const QFont::Weight&)));
connect(mBtnClassFG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedClassFG(const QColor&)));
connect(mCBClassWeight, SIGNAL(weightChanged(const QFont::Weight&)),
this, SLOT(weightChangedClass(const QFont::Weight&)));
connect(mBtnQuoteFG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedQuoteFG(const QColor&)));
connect(mCBQuoteWeight, SIGNAL(weightChanged(const QFont::Weight&)),
this, SLOT(weightChangedQuote(const QFont::Weight&)));
connect(mBtnCommentFG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedCommentFG(const QColor&)));
connect(mCBCommentWeight, SIGNAL(weightChanged(const QFont::Weight&)),
this, SLOT(weightChangedComment(const QFont::Weight&)));
connect(mBtnSymbolFG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedSymbolFG(const QColor&)));
connect(mBtnSymbolBG, SIGNAL(colorChanged(const QColor&)),
this, SLOT(colorChangedSymbolBG(const QColor&)));
connect(mCBSymbolWeight, SIGNAL(weightChanged(const QFont::Weight&)),
this, SLOT(weightChangedSymbol(const QFont::Weight&)));
connect(mBtnWidgetColorFG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedWidgetFG(QColor)));
connect(mBtnWidgetColorBG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedWidgetBG(QColor)));
connect(mBtnHighlightBG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedHighlightBG(QColor)));
connect(mBtnLineNumFG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedLineNumFG(QColor)));
connect(mBtnLineNumBG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedLineNumBG(QColor)));
connect(mBtnKeywordFG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedKeywordFG(QColor)));
connect(mCBKeywordWeight, SIGNAL(weightChanged(QFont::Weight)),
this, SLOT(weightChangedKeyword(QFont::Weight)));
connect(mBtnClassFG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedClassFG(QColor)));
connect(mCBClassWeight, SIGNAL(weightChanged(QFont::Weight)),
this, SLOT(weightChangedClass(QFont::Weight)));
connect(mBtnQuoteFG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedQuoteFG(QColor)));
connect(mCBQuoteWeight, SIGNAL(weightChanged(QFont::Weight)),
this, SLOT(weightChangedQuote(QFont::Weight)));
connect(mBtnCommentFG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedCommentFG(QColor)));
connect(mCBCommentWeight, SIGNAL(weightChanged(QFont::Weight)),
this, SLOT(weightChangedComment(QFont::Weight)));
connect(mBtnSymbolFG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedSymbolFG(QColor)));
connect(mBtnSymbolBG, SIGNAL(colorChanged(QColor)),
this, SLOT(colorChangedSymbolBG(QColor)));
connect(mCBSymbolWeight, SIGNAL(weightChanged(QFont::Weight)),
this, SLOT(weightChangedSymbol(QFont::Weight)));
}
void StyleEditDialog::updateControls()

View File

@ -79,7 +79,7 @@ QString getDataDir()
if (!dataDir.isEmpty())
return dataDir;
const QString appPath = QFileInfo(QCoreApplication::applicationFilePath()).canonicalPath();
if (QFileInfo(appPath + "/std.cfg").exists())
if (QFileInfo::exists(appPath + "/std.cfg"))
return appPath;
if (appPath.indexOf("/cppcheck/", 0, Qt::CaseInsensitive) > 0)
return appPath.left(appPath.indexOf("/cppcheck/", 0, Qt::CaseInsensitive) + 9);

View File

@ -66,7 +66,7 @@ static QString getHelpFile()
#endif
for (const QString &p: paths) {
QString filename = p + "/online-help.qhc";
if (QFileInfo(filename).exists())
if (QFileInfo::exists(filename))
return filename;
}
return QString();

View File

@ -137,7 +137,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
mLineEditFilter->setPlaceholderText(tr("Quick Filter:"));
mLineEditFilter->setClearButtonEnabled(true);
mUI->mToolBarFilter->addWidget(mLineEditFilter);
connect(mLineEditFilter, SIGNAL(textChanged(const QString&)), mFilterTimer, SLOT(start()));
connect(mLineEditFilter, SIGNAL(textChanged(QString)), mFilterTimer, SLOT(start()));
connect(mLineEditFilter, &QLineEdit::returnPressed, this, &MainWindow::filterResults);
connect(mUI->mActionPrint, SIGNAL(triggered()), mUI->mResults, SLOT(print()));
@ -610,14 +610,14 @@ void MainWindow::analyzeCode(const QString& code, const QString& filename)
// Initialize dummy ThreadResult as ErrorLogger
ThreadResult result;
result.setFiles(QStringList(filename));
connect(&result, SIGNAL(progress(int,const QString&)),
mUI->mResults, SLOT(progress(int,const QString&)));
connect(&result, SIGNAL(error(const ErrorItem&)),
mUI->mResults, SLOT(error(const ErrorItem&)));
connect(&result, SIGNAL(log(const QString&)),
mUI->mResults, SLOT(log(const QString&)));
connect(&result, SIGNAL(debugError(const ErrorItem&)),
mUI->mResults, SLOT(debugError(const ErrorItem&)));
connect(&result, SIGNAL(progress(int,QString)),
mUI->mResults, SLOT(progress(int,QString)));
connect(&result, SIGNAL(error(ErrorItem)),
mUI->mResults, SLOT(error(ErrorItem)));
connect(&result, SIGNAL(log(QString)),
mUI->mResults, SLOT(log(QString)));
connect(&result, SIGNAL(debugError(ErrorItem)),
mUI->mResults, SLOT(debugError(ErrorItem)));
// Create CppCheck instance
CppCheck cppcheck(result, true, nullptr);
@ -1649,7 +1649,7 @@ bool MainWindow::loadLastResults()
const QString &lastResults = getLastResults();
if (lastResults.isEmpty())
return false;
if (!QFileInfo(lastResults).exists())
if (!QFileInfo::exists(lastResults))
return false;
mUI->mResults->readErrorsXml(lastResults);
mUI->mResults->setCheckDirectory(mSettings->value(SETTINGS_LAST_CHECK_PATH,QString()).toString());
@ -1916,7 +1916,7 @@ void MainWindow::updateMRUMenuItems()
// Do a sanity check - remove duplicates and non-existing projects
int removed = projects.removeDuplicates();
for (int i = projects.size() - 1; i >= 0; i--) {
if (!QFileInfo(projects[i]).exists()) {
if (!QFileInfo::exists(projects[i])) {
projects.removeAt(i);
removed++;
}

View File

@ -861,7 +861,7 @@ QString ResultsTree::askFileDir(const QString &file)
return QString();
// User selected root path
if (QFileInfo(dir + '/' + file).exists())
if (QFileInfo::exists(dir + '/' + file))
mCheckPath = dir;
// user selected checked folder
@ -870,7 +870,7 @@ QString ResultsTree::askFileDir(const QString &file)
QString folderName = file.mid(0, file.indexOf('/'));
if (dir.indexOf('/' + folderName + '/'))
dir = dir.mid(0, dir.lastIndexOf('/' + folderName + '/'));
if (QFileInfo(dir + '/' + file).exists())
if (QFileInfo::exists(dir + '/' + file))
mCheckPath = dir;
}
@ -1018,7 +1018,6 @@ void ResultsTree::suppressSelectedIds()
if (!mSelectionModel)
return;
QModelIndexList selectedRows = mSelectionModel->selectedRows();
QSet<QString> selectedIds;
for (QModelIndex index : mSelectionModel->selectedRows()) {
QStandardItem *item = mModel.itemFromIndex(index);

View File

@ -383,7 +383,7 @@ void ResultsView::readErrorsXml(const QString &filename)
QString dir;
if (!errors.isEmpty() && !errors[0].errorPath.isEmpty()) {
QString relativePath = QFileInfo(filename).canonicalPath();
if (QFileInfo(relativePath + '/' + errors[0].errorPath[0].file).exists())
if (QFileInfo::exists(relativePath + '/' + errors[0].errorPath[0].file))
dir = relativePath;
}
@ -432,7 +432,7 @@ void ResultsView::updateDetails(const QModelIndex &index)
const int lineNumber = data["line"].toInt();
QString filepath = data["file"].toString();
if (!QFileInfo(filepath).exists() && QFileInfo(mUI->mTree->getCheckDirectory() + '/' + filepath).exists())
if (!QFileInfo::exists(filepath) && QFileInfo::exists(mUI->mTree->getCheckDirectory() + '/' + filepath))
filepath = mUI->mTree->getCheckDirectory() + '/' + filepath;
QStringList symbols;

View File

@ -92,7 +92,7 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
mCurrentStyle = new CodeEditorStyle(CodeEditorStyle::loadSettings(&settings));
manageStyleControls();
connect(mUI->mEditPythonPath, SIGNAL(textEdited(const QString&)),
connect(mUI->mEditPythonPath, SIGNAL(textEdited(QString)),
this, SLOT(validateEditPythonPath()));
connect(mUI->mButtons, &QDialogButtonBox::accepted, this, &SettingsDialog::ok);