summaryrefslogtreecommitdiff
path: root/ui/qt/interface_tree_model.cpp
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2016-10-18 22:28:28 +0200
committerAnders Broman <a.broman58@gmail.com>2016-10-19 07:44:48 +0000
commite68247e1fdc5a81872f5f3ee01a40ea71db71380 (patch)
tree7b4211c57270bdbf3b76258438367ac558fe92c7 /ui/qt/interface_tree_model.cpp
parent864f750be560a7a739c7453f19a8f5679cf7d6b3 (diff)
downloadwireshark-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.cpp19
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;