QmlProfiler: Fix note support in flamegraph view

The model didn't really support it and we didn't have any visualization
for it. Now the events with notes or binding loops get an orange border.

Change-Id: I903f1d42afaf3567484b615b22381d38fc81b9b5
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2016-03-02 11:12:12 +01:00
parent 443e75ba69
commit 0b7c63d69f
2 changed files with 34 additions and 27 deletions

View File

@@ -96,24 +96,8 @@ void FlameGraphModel::loadNotes(int typeIndex, bool emitSignal)
m_typeIdsWithNotes.insert(typeIndex);
}
if (!emitSignal)
return;
QQueue<QModelIndex> queue;
queue.append(QModelIndex());
QVector<int> roles = {Note};
while (!queue.isEmpty()) {
QModelIndex index = queue.takeFirst();
if (index.isValid()) {
FlameGraphData *data = static_cast<FlameGraphData *>(index.internalPointer());
if (changedNotes.contains(data->typeIndex))
emit dataChanged(index, index, roles);
for (int row = 0; row < rowCount(index); ++row)
queue.append(index.child(row, 0));
}
}
if (emitSignal)
emit dataChanged(QModelIndex(), QModelIndex(), QVector<int>() << Note);
}
void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd)
@@ -203,9 +187,9 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
QmlProfiler::QmlProfilerNotesModel *notes = m_modelManager->notesModel();
foreach (const QVariant &item, notes->byTypeId(stats.typeIndex)) {
if (ret.isEmpty())
ret = item.toString();
ret = notes->text(item.toInt());
else
ret += QChar::LineFeed + item.toString();
ret += QChar::LineFeed + notes->text(item.toInt());
}
return ret;
}