diff --git a/examples/embedded/flightinfo/flightinfo.cpp b/examples/embedded/flightinfo/flightinfo.cpp index e91277db58..f46fc9693f 100644 --- a/examples/embedded/flightinfo/flightinfo.cpp +++ b/examples/embedded/flightinfo/flightinfo.cpp @@ -270,19 +270,18 @@ private: inFlightStatus |= className == "FlightDetailHeaderStatus"; inFlightMap |= className == "flightMap"; if (xml.name() == "td" && !className.isEmpty()) { - QString cn = className.toString(); - if (cn.contains("fieldTitle")) { + if (className.contains("fieldTitle")) { inFieldName = true; fieldNames += QString(); fieldValues += QString(); } - if (cn.contains("fieldValue")) + if (className.contains("fieldValue")) inFieldValue = true; } if (xml.name() == "img" && inFlightMap) { - QString src = xml.attributes().value("src").toString(); - src.prepend("http://mobile.flightview.com/"); - QUrl url = QUrl::fromPercentEncoding(src.toLatin1()); + const QByteArray encoded + = ("http://mobile.flightview.com/" % xml.attributes().value("src")).toLatin1(); + QUrl url = QUrl::fromPercentEncoding(encoded); mapReplies.append(m_manager.get(QNetworkRequest(url))); } } diff --git a/examples/widgets/animation/sub-attaq/graphicsscene.cpp b/examples/widgets/animation/sub-attaq/graphicsscene.cpp index 44bd5dd12f..e0913f99f6 100644 --- a/examples/widgets/animation/sub-attaq/graphicsscene.cpp +++ b/examples/widgets/animation/sub-attaq/graphicsscene.cpp @@ -111,14 +111,15 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode) if (reader.name() == "submarine") { SubmarineDescription desc; desc.name = reader.attributes().value("name").toString(); - desc.points = reader.attributes().value("points").toString().toInt(); - desc.type = reader.attributes().value("type").toString().toInt(); + desc.points = reader.attributes().value("points").toInt(); + desc.type = reader.attributes().value("type").toInt(); submarinesData.append(desc); } else if (reader.name() == "level") { - currentLevel.id = reader.attributes().value("id").toString().toInt(); + currentLevel.id = reader.attributes().value("id").toInt(); currentLevel.name = reader.attributes().value("name").toString(); } else if (reader.name() == "subinstance") { - currentLevel.submarines.append(qMakePair(reader.attributes().value("type").toString().toInt(), reader.attributes().value("nb").toString().toInt())); + currentLevel.submarines.append(qMakePair(reader.attributes().value("type").toInt(), + reader.attributes().value("nb").toInt())); } } else if (reader.tokenType() == QXmlStreamReader::EndElement) { if (reader.name() == "level") { diff --git a/examples/xml/rsslisting/rsslisting.cpp b/examples/xml/rsslisting/rsslisting.cpp index f532148354..d1b4373531 100644 --- a/examples/xml/rsslisting/rsslisting.cpp +++ b/examples/xml/rsslisting/rsslisting.cpp @@ -231,9 +231,9 @@ void RSSListing::parseXml() } else if (xml.isCharacters() && !xml.isWhitespace()) { if (currentTag == "title") - titleString += xml.text().toString(); + titleString += xml.text(); else if (currentTag == "link") - linkString += xml.text().toString(); + linkString += xml.text(); } } if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) {