examples: remove some unneeded QStringRef::toString() calls
- when appending to another string - when just comparing - when just calling toInt() Change-Id: I6960784569b83bfd3e3640a8c04f2f909c293449 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
f497dea730
commit
25d1bbb849
@ -270,19 +270,18 @@ private:
|
|||||||
inFlightStatus |= className == "FlightDetailHeaderStatus";
|
inFlightStatus |= className == "FlightDetailHeaderStatus";
|
||||||
inFlightMap |= className == "flightMap";
|
inFlightMap |= className == "flightMap";
|
||||||
if (xml.name() == "td" && !className.isEmpty()) {
|
if (xml.name() == "td" && !className.isEmpty()) {
|
||||||
QString cn = className.toString();
|
if (className.contains("fieldTitle")) {
|
||||||
if (cn.contains("fieldTitle")) {
|
|
||||||
inFieldName = true;
|
inFieldName = true;
|
||||||
fieldNames += QString();
|
fieldNames += QString();
|
||||||
fieldValues += QString();
|
fieldValues += QString();
|
||||||
}
|
}
|
||||||
if (cn.contains("fieldValue"))
|
if (className.contains("fieldValue"))
|
||||||
inFieldValue = true;
|
inFieldValue = true;
|
||||||
}
|
}
|
||||||
if (xml.name() == "img" && inFlightMap) {
|
if (xml.name() == "img" && inFlightMap) {
|
||||||
QString src = xml.attributes().value("src").toString();
|
const QByteArray encoded
|
||||||
src.prepend("http://mobile.flightview.com/");
|
= ("http://mobile.flightview.com/" % xml.attributes().value("src")).toLatin1();
|
||||||
QUrl url = QUrl::fromPercentEncoding(src.toLatin1());
|
QUrl url = QUrl::fromPercentEncoding(encoded);
|
||||||
mapReplies.append(m_manager.get(QNetworkRequest(url)));
|
mapReplies.append(m_manager.get(QNetworkRequest(url)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,14 +111,15 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode)
|
|||||||
if (reader.name() == "submarine") {
|
if (reader.name() == "submarine") {
|
||||||
SubmarineDescription desc;
|
SubmarineDescription desc;
|
||||||
desc.name = reader.attributes().value("name").toString();
|
desc.name = reader.attributes().value("name").toString();
|
||||||
desc.points = reader.attributes().value("points").toString().toInt();
|
desc.points = reader.attributes().value("points").toInt();
|
||||||
desc.type = reader.attributes().value("type").toString().toInt();
|
desc.type = reader.attributes().value("type").toInt();
|
||||||
submarinesData.append(desc);
|
submarinesData.append(desc);
|
||||||
} else if (reader.name() == "level") {
|
} 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();
|
currentLevel.name = reader.attributes().value("name").toString();
|
||||||
} else if (reader.name() == "subinstance") {
|
} 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) {
|
} else if (reader.tokenType() == QXmlStreamReader::EndElement) {
|
||||||
if (reader.name() == "level") {
|
if (reader.name() == "level") {
|
||||||
|
@ -231,9 +231,9 @@ void RSSListing::parseXml()
|
|||||||
|
|
||||||
} else if (xml.isCharacters() && !xml.isWhitespace()) {
|
} else if (xml.isCharacters() && !xml.isWhitespace()) {
|
||||||
if (currentTag == "title")
|
if (currentTag == "title")
|
||||||
titleString += xml.text().toString();
|
titleString += xml.text();
|
||||||
else if (currentTag == "link")
|
else if (currentTag == "link")
|
||||||
linkString += xml.text().toString();
|
linkString += xml.text();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) {
|
if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) {
|
||||||
|
Loading…
Reference in New Issue
Block a user