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 typesDisplayed = proxyModel->typesDisplayed(); - foreach(int ifType, ifTypeDescription.keys()) + QMap::const_iterator it = ifTypeDescription.constBegin(); + while(it != ifTypeDescription.constEnd()) { - if ( ! typesDisplayed.contains(ifType) ) - continue; + int ifType = it.key(); - 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); + 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; diff --git a/ui/qt/interface_sort_filter_model.cpp b/ui/qt/interface_sort_filter_model.cpp index a09153e211..a8b9b45e1e 100644 --- a/ui/qt/interface_sort_filter_model.cpp +++ b/ui/qt/interface_sort_filter_model.cpp @@ -71,11 +71,13 @@ void InterfaceSortFilterModel::resetPreferenceData() if ( stored_prefs.length() > 0 ) { QStringList ifTypesStored = stored_prefs.split(','); - foreach(QString val, ifTypesStored) + QStringList::const_iterator it = ifTypesStored.constBegin(); + while(it != ifTypesStored.constEnd()) { - int i_val = val.toInt(); + int i_val = (*it).toInt(); if ( ! displayHiddenTypes.contains(i_val) ) displayHiddenTypes.append(i_val); + ++it; } } @@ -135,9 +137,11 @@ void InterfaceSortFilterModel::setInterfaceTypeVisible(int ifType, bool visible) return; QString new_pref; - foreach(int i, displayHiddenTypes) + QList::const_iterator it = displayHiddenTypes.constBegin(); + while( it != displayHiddenTypes.constEnd() ) { - new_pref.append(QString("%1,").arg(i)); + new_pref.append(QString("%1,").arg(*it)); + ++it; } if (new_pref.length() > 0) new_pref = new_pref.left(new_pref.length() - 1); 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::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 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;