Commit 54b366d7 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: replace calls to QVector::length() with QVector::size()



Like that we get a higher chance of staying compatible with Qt < 5.2.

Change-Id: Iecd6e1fbf75bd610917a38a22635a0d8e731738f
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent b9d349bd
......@@ -129,7 +129,7 @@ int AbstractTimelineModel::rowHeight(int rowNumber) const
if (!expanded())
return DefaultRowHeight;
if (d->rowOffsets.length() > rowNumber)
if (d->rowOffsets.size() > rowNumber)
return d->rowOffsets[rowNumber] - (rowNumber > 0 ? d->rowOffsets[rowNumber - 1] : 0);
return DefaultRowHeight;
}
......@@ -142,10 +142,10 @@ int AbstractTimelineModel::rowOffset(int rowNumber) const
if (!expanded())
return DefaultRowHeight * rowNumber;
if (d->rowOffsets.length() >= rowNumber)
if (d->rowOffsets.size() >= rowNumber)
return d->rowOffsets[rowNumber - 1];
if (!d->rowOffsets.empty())
return d->rowOffsets.last() + (rowNumber - 1 - d->rowOffsets.length()) * DefaultRowHeight;
return d->rowOffsets.last() + (rowNumber - 1 - d->rowOffsets.size()) * DefaultRowHeight;
return rowNumber * DefaultRowHeight;
}
......@@ -158,12 +158,12 @@ void AbstractTimelineModel::setRowHeight(int rowNumber, int height)
height = DefaultRowHeight;
int nextOffset = d->rowOffsets.empty() ? 0 : d->rowOffsets.last();
while (d->rowOffsets.length() <= rowNumber)
while (d->rowOffsets.size() <= rowNumber)
d->rowOffsets << (nextOffset += DefaultRowHeight);
int difference = height - d->rowOffsets[rowNumber] +
(rowNumber > 0 ? d->rowOffsets[rowNumber - 1] : 0);
if (difference != 0) {
for (; rowNumber < d->rowOffsets.length(); ++rowNumber) {
for (; rowNumber < d->rowOffsets.size(); ++rowNumber) {
d->rowOffsets[rowNumber] += difference;
}
emit rowHeightChanged();
......@@ -177,7 +177,7 @@ int AbstractTimelineModel::height() const
if (!expanded() || d->rowOffsets.empty())
return depth * DefaultRowHeight;
return d->rowOffsets.last() + (depth - d->rowOffsets.length()) * DefaultRowHeight;
return d->rowOffsets.last() + (depth - d->rowOffsets.size()) * DefaultRowHeight;
}
qint64 AbstractTimelineModel::traceStartTime() const
......
......@@ -148,7 +148,7 @@ void RangeTimelineModel::RangeTimelineModelPrivate::computeNestingContracted()
// per type
if (nestingEndTimes[nestingLevels] > st) {
if (++nestingLevels == nestingEndTimes.length())
if (++nestingLevels == nestingEndTimes.size())
nestingEndTimes << 0;
if (nestingLevels == contractedRows)
++contractedRows;
......@@ -170,7 +170,7 @@ void RangeTimelineModel::RangeTimelineModelPrivate::computeExpandedLevels()
for (int i = 0; i < eventCount; i++) {
int eventId = ranges[i].eventId;
if (!eventRow.contains(eventId)) {
eventRow[eventId] = expandedRowTypes.length();
eventRow[eventId] = expandedRowTypes.size();
expandedRowTypes << eventId;
}
ranges[i].displayRowExpanded = eventRow[eventId];
......@@ -222,7 +222,7 @@ int RangeTimelineModel::rowCount() const
if (d->rangeType == QmlDebug::Painting && !d->seenPaintEvent)
return 0;
if (d->expanded)
return d->expandedRowTypes.length();
return d->expandedRowTypes.size();
else
return d->contractedRows;
}
......@@ -371,7 +371,7 @@ int RangeTimelineModel::getEventIdForLocation(const QString &filename, int line,
// if this is called from v8 view, we don't have the column number, it will be -1
const QVector<QmlProfilerDataModel::QmlEventTypeData> &types =
d->modelManager->qmlModel()->getEventTypes();
for (int i = 0; i < d->expandedRowTypes.length(); ++i) {
for (int i = 0; i < d->expandedRowTypes.size(); ++i) {
int typeId = d->expandedRowTypes[i];
const QmlProfilerDataModel::QmlEventTypeData &eventData = types[typeId];
if (eventData.location.filename == filename &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment