aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/resourceeditor
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2022-10-05 13:27:13 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2022-10-07 07:44:24 +0000
commit43bc23557f5c4c5829e0e6b5aa5b89401b50f60d (patch)
tree86b7f304a77023bf39a7c67ba122eb64da2013b0 /src/plugins/resourceeditor
parent9feeb818479f1ceac5d109cfb358488298f52390 (diff)
ResourceFile: Don't derive from QList
Add a static helper instead. Change-Id: Id9711355e3dacacd2764249080b608dbbe124565 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/resourceeditor')
-rw-r--r--src/plugins/resourceeditor/qrceditor/resourcefile.cpp8
-rw-r--r--src/plugins/resourceeditor/qrceditor/resourcefile_p.h6
2 files changed, 5 insertions, 9 deletions
diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
index ab2ecfff05..a5f70b24ae 100644
--- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
+++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
@@ -66,9 +66,9 @@ void File::setExists(bool exists)
** FileList
*/
-bool FileList::containsFile(File *file)
+static bool containsFile(const FileList &list, File *file)
{
- foreach (const File *tmpFile, *this)
+ for (const File *tmpFile : list)
if (tmpFile->name == file->name && tmpFile->prefix() == file->prefix())
return true;
return false;
@@ -453,7 +453,7 @@ bool ResourceFile::contains(const QString &prefix, const QString &lang, const QS
Prefix * const p = m_prefix_list.at(pref_idx);
Q_ASSERT(p);
File equalFile(p, absolutePath(file));
- return p->file_list.containsFile(&equalFile);
+ return containsFile(p->file_list, &equalFile);
}
bool ResourceFile::contains(int pref_idx, const QString &file) const
@@ -461,7 +461,7 @@ bool ResourceFile::contains(int pref_idx, const QString &file) const
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
Prefix * const p = m_prefix_list.at(pref_idx);
File equalFile(p, absolutePath(file));
- return p->file_list.containsFile(&equalFile);
+ return containsFile(p->file_list, &equalFile);
}
/*static*/ QString ResourceFile::fixPrefix(const QString &prefix)
diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile_p.h b/src/plugins/resourceeditor/qrceditor/resourcefile_p.h
index e9d2a52144..3a811a98e9 100644
--- a/src/plugins/resourceeditor/qrceditor/resourcefile_p.h
+++ b/src/plugins/resourceeditor/qrceditor/resourcefile_p.h
@@ -70,11 +70,7 @@ private:
bool m_exists;
};
-class FileList : public QList<File *>
-{
-public:
- bool containsFile(File *file);
-};
+using FileList = QList<File *>;
/*!
\class Prefix