summaryrefslogtreecommitdiffstats
path: root/examples/network/bearermonitor/bearermonitor.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-08-03 10:53:57 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-08-03 10:53:57 (GMT)
commitd5491ecdde14659a913c9f476f18c45f1d9489bb (patch)
tree06cc52249feda9bd9e50ca47abb8ebd676c8a309 /examples/network/bearermonitor/bearermonitor.cpp
parent42cdfaf86d34afeb6448723839fef70fe477deed (diff)
parenta41128af5373a0225c3548abd3eb82cd7e8f7a0e (diff)
downloadQt-d5491ecdde14659a913c9f476f18c45f1d9489bb.zip
Qt-d5491ecdde14659a913c9f476f18c45f1d9489bb.tar.gz
Qt-d5491ecdde14659a913c9f476f18c45f1d9489bb.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into lighthouse
Conflicts: configure
Diffstat (limited to 'examples/network/bearermonitor/bearermonitor.cpp')
-rw-r--r--examples/network/bearermonitor/bearermonitor.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp
index 98869ea..1959919 100644
--- a/examples/network/bearermonitor/bearermonitor.cpp
+++ b/examples/network/bearermonitor/bearermonitor.cpp
@@ -180,10 +180,8 @@ void BearerMonitor::configurationChanged(const QNetworkConfiguration &config)
void BearerMonitor::updateSnapConfiguration(QTreeWidgetItem *parent, const QNetworkConfiguration &snap)
{
QMap<QString, QTreeWidgetItem *> itemMap;
- for (int i = 0; i < parent->childCount(); ++i) {
- QTreeWidgetItem *item = parent->child(i);
+ foreach (QTreeWidgetItem *item, parent->takeChildren())
itemMap.insert(item->data(0, Qt::UserRole).toString(), item);
- }
QList<QNetworkConfiguration> allConfigurations = snap.children();
@@ -194,6 +192,8 @@ void BearerMonitor::updateSnapConfiguration(QTreeWidgetItem *parent, const QNetw
if (item) {
updateItem(item, config);
+ parent->addChild(item);
+
if (config.type() == QNetworkConfiguration::ServiceNetwork)
updateSnapConfiguration(item, config);
} else {
@@ -201,10 +201,7 @@ void BearerMonitor::updateSnapConfiguration(QTreeWidgetItem *parent, const QNetw
}
}
- foreach (const QString &id, itemMap.keys())
- delete itemMap.value(id);
-
- itemMap.clear();
+ qDeleteAll(itemMap);
}
void BearerMonitor::updateConfigurations()
@@ -239,8 +236,7 @@ void BearerMonitor::updateConfigurations()
}
}
- foreach (const QString &id, itemMap.keys())
- delete itemMap.value(id);
+ qDeleteAll(itemMap);
}
void BearerMonitor::onlineStateChanged(bool isOnline)