diff options
author | Ulf Hermann <[email protected]> | 2018-03-28 09:42:28 +0200 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2018-04-17 12:20:57 +0000 |
commit | dcd8d37f351803fc0a1b9402b6503fd8dce93a09 (patch) | |
tree | 81bd147064da73d89c4190367e09228e89a22c7f /src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp | |
parent | 7ca958fa85a9855ae658eaa3fa38e60b1279fb04 (diff) |
QmlProfiler: Don't expose the vector of event types
We always want either the total number of event types or one specific
type. There is no need to expose the fact that we keep them as a vector.
Also, use int as the type of the "number" methods as that aligns better
with Qt containers, and rename the methods. We don't need to state the
fact that we've loaded the events and types at some point.
Change-Id: Iaf680ec9fa10e1070ddee6bcc079800e401775f0
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp index 5cdfa0d9108..13b6064eb46 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp @@ -127,9 +127,8 @@ QStringList QmlProfilerStatisticsModel::details(int typeIndex) const QString data; QString displayName; - const QVector<QmlEventType> &eventTypes = m_modelManager->eventTypes(); - if (typeIndex >= 0 && typeIndex < eventTypes.count()) { - const QmlEventType &type = eventTypes.at(typeIndex); + if (typeIndex >= 0 && typeIndex < m_modelManager->numEventTypes()) { + const QmlEventType &type = m_modelManager->eventType(typeIndex); displayName = nameForType(type.rangeType()); const QChar ellipsisChar(0x2026); @@ -272,7 +271,7 @@ QVariant QmlProfilerStatisticsModel::data(const QModelIndex &index, int role) co return dataForMainEntry(index, role); const int typeIndex = index.row(); - const QmlEventType &type = m_modelManager->eventTypes().at(typeIndex); + const QmlEventType &type = m_modelManager->eventType(typeIndex); const QmlEventStats &stats = m_data.at(typeIndex); switch (role) { @@ -448,7 +447,7 @@ void QmlProfilerStatisticsModel::loadEvent(const QmlEvent &event, const QmlEvent case RangeStart: stack.push(event); if (m_data.length() <= typeIndex) - m_data.resize(m_modelManager->numLoadedEventTypes()); + m_data.resize(m_modelManager->numEventTypes()); break; case RangeEnd: { // update stats @@ -610,13 +609,11 @@ QVariant QmlProfilerStatisticsRelativesModel::data(const QModelIndex &index, int const QmlStatisticsRelativesData &stats = data.at(row); QTC_ASSERT(stats.typeIndex >= 0, return QVariant()); - const QVector<QmlEventType> &eventTypes = m_modelManager->eventTypes(); - if (stats.typeIndex == QmlProfilerStatisticsModel::s_mainEntryTypeId) return dataForMainEntry(stats.duration, role, index.column()); - QTC_ASSERT(stats.typeIndex < eventTypes.size(), return QVariant()); - const QmlEventType &type = eventTypes.at(stats.typeIndex); + QTC_ASSERT(stats.typeIndex < m_modelManager->numEventTypes(), return QVariant()); + const QmlEventType &type = m_modelManager->eventType(stats.typeIndex); switch (role) { case TypeIdRole: |