aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-06-06 18:04:53 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-06-10 09:02:37 +0000
commit472745fb2eda6f1f35791583a7aeae369737e14f (patch)
tree3fbb7acac82744ac63bf8f92101d5bb090805fea /src/plugins/qmlprofiler/qmlprofilertracefile.cpp
parenta41593c3956f2adeeaf6060ba8beb9082477a313 (diff)
QmlProfiler: Make members of QmlEventLocation private
You should not change them independently as that is error-prone. Change-Id: I07890a29b045492fe804b9537094dea763bc1b8d Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilertracefile.cpp')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertracefile.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
index 0bf0880cc6..ede4af154f 100644
--- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
@@ -300,6 +300,9 @@ void QmlProfilerFileReader::loadEventTypes(QXmlStreamReader &stream)
};
const QmlEventType defaultEvent = type;
+ QString filename;
+ int line = 0, column = 0;
+
while (!stream.atEnd() && !stream.hasError()) {
if (isCanceled())
return;
@@ -342,17 +345,17 @@ void QmlProfilerFileReader::loadEventTypes(QXmlStreamReader &stream)
}
if (elementName == _("filename")) {
- type.location.filename = readData;
+ filename = readData;
break;
}
if (elementName == _("line")) {
- type.location.line = readData.toInt();
+ line = readData.toInt();
break;
}
if (elementName == _("column")) {
- type.location.column = readData.toInt();
+ column = readData.toInt();
break;
}
@@ -392,6 +395,9 @@ void QmlProfilerFileReader::loadEventTypes(QXmlStreamReader &stream)
if (typeIndex >= 0) {
if (typeIndex >= m_eventTypes.size())
m_eventTypes.resize(typeIndex + 1);
+ type.location = QmlEventLocation(filename, line, column);
+ filename.clear();
+ line = column = 0;
m_eventTypes[typeIndex] = type;
ProfileFeature feature = type.feature();
if (feature != MaximumProfileFeature)
@@ -620,10 +626,10 @@ void QmlProfilerFileWriter::saveQtd(QIODevice *device)
stream.writeAttribute(_("index"), QString::number(typeIndex));
stream.writeTextElement(_("displayname"), type.displayName);
stream.writeTextElement(_("type"), qmlTypeAsString(type.message, type.rangeType));
- if (!type.location.filename.isEmpty()) {
- stream.writeTextElement(_("filename"), type.location.filename);
- stream.writeTextElement(_("line"), QString::number(type.location.line));
- stream.writeTextElement(_("column"), QString::number(type.location.column));
+ if (!type.location.filename().isEmpty()) {
+ stream.writeTextElement(_("filename"), type.location.filename());
+ stream.writeTextElement(_("line"), QString::number(type.location.line()));
+ stream.writeTextElement(_("column"), QString::number(type.location.column()));
}
if (!type.data.isEmpty())