Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/evidence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,9 @@ void Courtroom::evidence_load(QString filename)
inventory.setIniCodec("UTF-8");
#endif
private_evidence_list.clear();
foreach (QString evi, inventory.childGroups())
QStringList sortedInventory = inventory.childGroups();
std::sort(sortedInventory.begin(), sortedInventory.end(), [](const QString &a, const QString &b) { return a.toInt() < b.toInt(); });
foreach (QString evi, sortedInventory)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I can suggest anything, don't use Qt's keywords. Just use the proper for loop rather than foreach.

// before
foreach (QString evi, sortedInventory)

// after
for (const QString &group : std::as_const(sortedInventory))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is better in general, though for this particular case, I would offer that it can pass as is.

{
if (evi == "General")
{
Expand Down
Loading