-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed a few warnings #1870
Fixed a few warnings #1870
Conversation
app/src/importimageseqdialog.cpp
Outdated
@@ -275,7 +272,7 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons | |||
dot = finalList[0].lastIndexOf("."); | |||
|
|||
QStringList absolutePaths; | |||
for (QString fileName : finalList) { | |||
for (const QString &fileName : finalList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const QString &fileName : finalList) { | |
for (const QString &fileName : qAsCost(finalList)) { |
By adding const here, you'll probably get an additional warning for 'Might detach container', as sch we use qAsConst(...) to make the list const also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a separate warning with many occurrences but not all of them went away by adding qAsCost()
and it felt like it just made the code less readable in many places, so I just skipped it entirely. thanks for the info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I recalled that we used it elsewhere in the code but it doesn't seem so.. it's likely because of backward compatibility then.
Alright ignore those comments 😅
@@ -562,7 +562,7 @@ int FileManager::countExistingBackups(const QString& fileName) const | |||
const QString& baseName = fileInfo.completeBaseName(); | |||
|
|||
int backupCount = 0; | |||
for (QFileInfo dirFileInfo : directory.entryInfoList(QDir::Filter::Files)) { | |||
for (const QFileInfo &dirFileInfo : directory.entryInfoList(QDir::Filter::Files)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const QFileInfo &dirFileInfo : directory.entryInfoList(QDir::Filter::Files)) { | |
for (const QFileInfo& dirFileInfo : qAsConst(directory.entryInfoList(QDir::Filter::Files))) { { |
By adding const here, you'll get an additional warning saying 'Might detach container', as such we use qAsConst(...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's always nice to get rid of warnings, thanks for taking the initiative to fix them.
I will merge the PR now.
This PR fixes a handful of simple warnings, mostly missing
emit
keywords and unused QStrings.There were a lot more warnings but unfortunately my Qt and C++ knowledge isn't good enough to handle those so I decided not to risk breaking something. At least I fixed more than just the missing
emit
s.