forked from qt-creator/qt-creator
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 <tobias.hunger@qt.io>
This commit is contained in:
@@ -202,13 +202,14 @@ QVariantList QmlProfilerRangeModel::labels() const
|
||||
{
|
||||
QVariantList result;
|
||||
|
||||
const QVector<QmlEventType> &types = modelManager()->eventTypes();
|
||||
const QmlProfilerModelManager *manager = modelManager();
|
||||
for (int i = 1; i < expandedRowCount(); i++) { // Ignore the -1 for the first row
|
||||
QVariantMap element;
|
||||
int typeId = m_expandedRowTypes[i];
|
||||
element.insert(QLatin1String("displayName"), QVariant(types[typeId].displayName()));
|
||||
element.insert(QLatin1String("description"), QVariant(types[typeId].data()));
|
||||
element.insert(QLatin1String("id"), QVariant(typeId));
|
||||
const int typeId = m_expandedRowTypes[i];
|
||||
const QmlEventType &type = manager->eventType(typeId);
|
||||
element.insert(QLatin1String("displayName"), type.displayName());
|
||||
element.insert(QLatin1String("description"), type.data());
|
||||
element.insert(QLatin1String("id"), typeId);
|
||||
result << element;
|
||||
}
|
||||
|
||||
@@ -219,14 +220,14 @@ QVariantMap QmlProfilerRangeModel::details(int index) const
|
||||
{
|
||||
QVariantMap result;
|
||||
int id = selectionId(index);
|
||||
const QVector<QmlEventType> &types = modelManager()->eventTypes();
|
||||
|
||||
result.insert(QStringLiteral("displayName"),
|
||||
tr(QmlProfilerModelManager::featureName(mainFeature())));
|
||||
result.insert(tr("Duration"), Timeline::formatTime(duration(index)));
|
||||
|
||||
result.insert(tr("Details"), types[id].data());
|
||||
result.insert(tr("Location"), types[id].displayName());
|
||||
const QmlEventType &type = modelManager()->eventType(id);
|
||||
result.insert(tr("Details"), type.data());
|
||||
result.insert(tr("Location"), type.displayName());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user