QmlProfiler: Disambiguate parent/child terminology in statistics

When talking about call stacks call them "caller" and "callee". Call
the invisible root item of the model "rootItem".

Change-Id: I551b23f1491d391145193901d3f3a29ab3942089
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Ulf Hermann
2018-03-23 10:14:48 +01:00
parent abfe7fd3c7
commit 5de5794c49
3 changed files with 18 additions and 18 deletions

View File

@@ -153,7 +153,7 @@ static QString displayHeader(RelativeField header, QmlProfilerStatisticsRelation
{
switch (header) {
case RelativeLocation:
return relation == QmlProfilerStatisticsChilden
return relation == QmlProfilerStatisticsCallees
? QmlProfilerStatisticsMainView::tr("Callee")
: QmlProfilerStatisticsMainView::tr("Caller");
case RelativeType:
@@ -163,7 +163,7 @@ static QString displayHeader(RelativeField header, QmlProfilerStatisticsRelation
case RelativeCallCount:
return displayHeader(MainCallCount);
case RelativeDetails:
return relation == QmlProfilerStatisticsChilden
return relation == QmlProfilerStatisticsCallees
? QmlProfilerStatisticsMainView::tr("Callee Description")
: QmlProfilerStatisticsMainView::tr("Caller Description");
case MaxRelativeField:
@@ -198,10 +198,10 @@ QmlProfilerStatisticsView::QmlProfilerStatisticsView(QmlProfilerModelManager *pr
m_calleesView.reset(new QmlProfilerStatisticsRelativesView(
new QmlProfilerStatisticsRelativesModel(profilerModelManager, model,
QmlProfilerStatisticsChilden)));
QmlProfilerStatisticsCallees)));
m_callersView.reset(new QmlProfilerStatisticsRelativesView(
new QmlProfilerStatisticsRelativesModel(profilerModelManager, model,
QmlProfilerStatisticsParents)));
QmlProfilerStatisticsCallers)));
connect(m_mainView.get(), &QmlProfilerStatisticsMainView::typeSelected,
m_calleesView.get(), &QmlProfilerStatisticsRelativesView::displayType);
connect(m_mainView.get(), &QmlProfilerStatisticsMainView::typeSelected,
@@ -457,16 +457,16 @@ void QmlProfilerStatisticsMainView::updateNotes(int typeIndex)
{
const QHash<int, QmlProfilerStatisticsModel::QmlEventStats> &eventList = m_model->getData();
const QHash<int, QString> &noteList = m_model->getNotes();
QStandardItem *parentItem = m_standardItemModel->invisibleRootItem();
QStandardItem *rootItem = m_standardItemModel->invisibleRootItem();
for (int rowIndex = 0; rowIndex < parentItem->rowCount(); ++rowIndex) {
int rowType = parentItem->child(rowIndex)->data(TypeIdRole).toInt();
for (int rowIndex = 0; rowIndex < rootItem->rowCount(); ++rowIndex) {
int rowType = rootItem->child(rowIndex)->data(TypeIdRole).toInt();
if (rowType != typeIndex && typeIndex != -1)
continue;
const QmlProfilerStatisticsModel::QmlEventStats &stats = eventList[rowType];
for (int columnIndex = 0; columnIndex < parentItem->columnCount(); ++columnIndex) {
QStandardItem *item = parentItem->child(rowIndex, columnIndex);
for (int columnIndex = 0; columnIndex < rootItem->columnCount(); ++columnIndex) {
QStandardItem *item = rootItem->child(rowIndex, columnIndex);
QHash<int, QString>::ConstIterator it = noteList.find(rowType);
if (it != noteList.end()) {
item->setBackground(colors()->noteBackground);
@@ -513,7 +513,7 @@ void QmlProfilerStatisticsMainView::parseModel()
int typeIndex = it.key();
const QmlProfilerStatisticsModel::QmlEventStats &stats = it.value();
const QmlEventType &type = (typeIndex != -1 ? typeList[typeIndex] : *rootEventType());
QStandardItem *parentItem = m_standardItemModel->invisibleRootItem();
QStandardItem *rootItem = m_standardItemModel->invisibleRootItem();
QList<QStandardItem *> newRow;
newRow << new StatisticsViewItem(
@@ -569,7 +569,7 @@ void QmlProfilerStatisticsMainView::parseModel()
first->setData(location.column(), ColumnRole);
// append
parentItem->appendRow(newRow);
rootItem->appendRow(newRow);
}
}