From 180e6cd48e8875988abf66f8c939a94e9db98ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Alvarez?= Date: Mon, 20 Feb 2023 21:30:07 -0300 Subject: Fix build of PacketListModel with Qt5 a9a7dcec21 broke the build by using std::as_const (new in C++17, we require C++11). 189d93b4b8 switched to using a for loop with indices, but that still fails on Qt5, because Qt5 uses int instead of qsizetype. Switch back to the foreach-style loop, but using C++11 range-for instead of Qt's foreach (which is semi-deprecated). Also, use qAsConst, which works in C++11, instead of std::as_const. --- ui/qt/models/packet_list_model.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp index 366bf647e5..ec7d1b9cd7 100644 --- a/ui/qt/models/packet_list_model.cpp +++ b/ui/qt/models/packet_list_model.cpp @@ -340,8 +340,7 @@ void PacketListModel::addFrameComment(const QModelIndexList &indices, const QByt frame_data *fdata; if (!cap_file_) return; - for (qsizetype i = 0; i < indices.size(); ++i) { - const auto &index = indices.at(i); + for (const auto &index : qAsConst(indices)) { if (!index.isValid()) continue; PacketListRecord *record = static_cast(index.internalPointer()); @@ -415,8 +414,7 @@ void PacketListModel::deleteFrameComments(const QModelIndexList &indices) frame_data *fdata; if (!cap_file_) return; - for (qsizetype i = 0; i < indices.size(); ++i) { - const auto &index = indices.at(i); + for (const auto &index : qAsConst(indices)) { if (!index.isValid()) continue; PacketListRecord *record = static_cast(index.internalPointer()); -- cgit v1.2.3