summaryrefslogtreecommitdiff
path: root/ui/qt/interface_frame.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_frame.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_frame.cpp')
-rw-r--r--ui/qt/interface_frame.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index d79f2c06a3..1e1a140c8b 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -116,17 +116,21 @@ QMenu * InterfaceFrame::getSelectionMenu()
QMenu * contextMenu = new QMenu();
QList<int> typesDisplayed = proxyModel->typesDisplayed();
- foreach(int ifType, ifTypeDescription.keys())
+ QMap<int, QString>::const_iterator it = ifTypeDescription.constBegin();
+ while(it != ifTypeDescription.constEnd())
{
- if ( ! typesDisplayed.contains(ifType) )
- continue;
-
- QAction *endp_action = new QAction(ifTypeDescription[ifType], this);
- endp_action->setData(qVariantFromValue(ifType));
- endp_action->setCheckable(true);
- endp_action->setChecked(proxyModel->isInterfaceTypeShown(ifType));
- connect(endp_action, SIGNAL(triggered()), this, SLOT(triggeredIfTypeButton()));
- contextMenu->addAction(endp_action);
+ int ifType = it.key();
+
+ if ( typesDisplayed.contains(ifType) )
+ {
+ QAction *endp_action = new QAction(it.value(), this);
+ endp_action->setData(qVariantFromValue(ifType));
+ endp_action->setCheckable(true);
+ endp_action->setChecked(proxyModel->isInterfaceTypeShown(ifType));
+ connect(endp_action, SIGNAL(triggered()), this, SLOT(triggeredIfTypeButton()));
+ contextMenu->addAction(endp_action);
+ }
+ ++it;
}
return contextMenu;