On 1/14/24 19:16, Benjamin ROBIN wrote:
Use const_iterator instead. Fix container-anti-pattern Clazy warning Signed-off-by: Benjamin ROBIN <dev@xxxxxxxxxxxxx> --- src/KsAdvFilteringDialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/KsAdvFilteringDialog.cpp b/src/KsAdvFilteringDialog.cpp index 4683c3d..247f912 100644 --- a/src/KsAdvFilteringDialog.cpp +++ b/src/KsAdvFilteringDialog.cpp @@ -276,8 +276,8 @@ void KsAdvFilteringDialog::_makeFilterTable() headers << "Delete" << "Stream" << "Event" << " Id" << "Filter"; _table->init(headers, _filters.count());- for(auto f : _filters.keys()) {- QStringList thisFilter = _filters.value(f).split(":"); + for (auto it = _filters.cbegin(), end = _filters.cend(); it != end; ++it) {
Do we need to use iterator here? Perhaps you can do something like: for (const auto &[key, val] : _filters) { Thanks! Y.
+ QStringList thisFilter = it.value().split(":");i1 = new QTableWidgetItem(thisFilter[0]);_table->setItem(count, 1, i1); @@ -285,7 +285,7 @@ void KsAdvFilteringDialog::_makeFilterTable() i1 = new QTableWidgetItem(thisFilter[1]); _table->setItem(count, 2, i1);- i2 = new QTableWidgetItem(tr("%1").arg(f));+ i2 = new QTableWidgetItem(tr("%1").arg(it.key())); _table->setItem(count, 3, i2);i3 = new QTableWidgetItem(thisFilter[2]);