summaryrefslogtreecommitdiffstats
path: root/examples/network/googlesuggest/googlesuggest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/googlesuggest/googlesuggest.cpp')
-rw-r--r--examples/network/googlesuggest/googlesuggest.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/network/googlesuggest/googlesuggest.cpp b/examples/network/googlesuggest/googlesuggest.cpp
index ada0edf..4142511 100644
--- a/examples/network/googlesuggest/googlesuggest.cpp
+++ b/examples/network/googlesuggest/googlesuggest.cpp
@@ -134,7 +134,6 @@ bool GSuggestCompletion::eventFilter(QObject *obj, QEvent *ev)
void GSuggestCompletion::showCompletion(const QStringList &choices, const QStringList &hits)
{
-
if (choices.isEmpty() || choices.count() != hits.count())
return;
@@ -204,16 +203,16 @@ void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply)
QXmlStreamReader xml(response);
while (!xml.atEnd()) {
xml.readNext();
- if (xml.tokenType() == QXmlStreamReader::StartElement)
+ if (xml.isStartElement()) {
if (xml.name() == "suggestion") {
QStringRef str = xml.attributes().value("data");
choices << str.toString();
}
- if (xml.tokenType() == QXmlStreamReader::StartElement)
- if (xml.name() == "num_queries") {
+ else if (xml.name() == "num_queries") {
QStringRef str = xml.attributes().value("int");
hits << str.toString();
}
+ }
}
showCompletion(choices, hits);