diff options
author | Roland Knall <rknall@gmail.com> | 2016-10-18 22:28:28 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-10-19 07:44:48 +0000 |
commit | e68247e1fdc5a81872f5f3ee01a40ea71db71380 (patch) | |
tree | 7b4211c57270bdbf3b76258438367ac558fe92c7 /ui/qt/interface_tree_model.cpp | |
parent | 864f750be560a7a739c7453f19a8f5679cf7d6b3 (diff) | |
download | wireshark-e68247e1fdc5a81872f5f3ee01a40ea71db71380.tar.gz |
InterfaceTree: Change foreach to const_iterator
Change all occurences of the foreach macro to while loops with
const_iterator for performance reasons
Change-Id: I1cd378696136b3d6cc100b9bfff95295baa2ff83
Reviewed-on: https://code.wireshark.org/review/18286
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/interface_tree_model.cpp')
-rw-r--r-- | ui/qt/interface_tree_model.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/ui/qt/interface_tree_model.cpp b/ui/qt/interface_tree_model.cpp index 013062999c..4d4fb971c0 100644 --- a/ui/qt/interface_tree_model.cpp +++ b/ui/qt/interface_tree_model.cpp @@ -253,8 +253,12 @@ void InterfaceTreeModel::interfaceListChanged() { emit beginResetModel(); - foreach(QString key, points.keys()) - points[key]->clear(); + QMap<QString, PointList *>::const_iterator it = points.constBegin(); + while(it != points.constEnd()) + { + it.value()->clear(); + ++it; + } points.clear(); emit endResetModel(); @@ -412,15 +416,22 @@ bool InterfaceTreeModel::updateSelectedDevices(QItemSelection sourceSelection) #ifdef HAVE_LIBPCAP QList<int> selectedIndices; - foreach(QItemSelectionRange selection, sourceSelection) + QItemSelection::const_iterator it = sourceSelection.constBegin(); + while(it != sourceSelection.constEnd()) { - foreach(QModelIndex index, selection.indexes()) + QModelIndexList indeces = ((QItemSelectionRange) (*it)).indexes(); + + QModelIndexList::const_iterator cit = indeces.constBegin(); + while(cit != indeces.constEnd()) { + QModelIndex index = (QModelIndex) (*cit); if ( ! selectedIndices.contains(index.row()) ) { selectedIndices.append(index.row()); } + ++cit; } + ++it; } global_capture_opts.num_selected = 0; |