diff --git a/src/plugins/qmlprofilerextension/FlameGraphView.qml b/src/plugins/qmlprofilerextension/FlameGraphView.qml index eacc7ccb090..419e76aaa66 100644 --- a/src/plugins/qmlprofilerextension/FlameGraphView.qml +++ b/src/plugins/qmlprofilerextension/FlameGraphView.qml @@ -51,6 +51,9 @@ ScrollView { property color blue2: Qt.rgba(0.375, 0, 1, 1) property color grey1: "#B0B0B0" property color grey2: "#A0A0A0" + property color orange: "orange" + + function checkBindingLoop(otherTypeId) {return false;} id: flamegraph width: parent.width @@ -62,22 +65,32 @@ ScrollView { delegate: Item { id: flamegraphItem + + property int typeId: FlameGraph.data(FlameGraphModel.TypeId) || -1 + property bool isBindingLoop: parent.checkBindingLoop(typeId) property int level: parent.level + (rangeTypeVisible ? 1 : 0) - property bool isSelected: FlameGraph.data(FlameGraphModel.TypeId) === - root.selectedTypeId + property bool isSelected: typeId !== -1 && typeId === root.selectedTypeId property bool rangeTypeVisible: root.visibleRangeTypes & (1 << FlameGraph.data(FlameGraphModel.RangeType)) onIsSelectedChanged: { if (isSelected && (tooltip.selectedNode === null || - tooltip.selectedNode.FlameGraph.data(FlameGraphModel.TypeId) !== - root.selectedTypeId)) { + tooltip.selectedNode.typeId !== root.selectedTypeId)) { tooltip.selectedNode = flamegraphItem; } else if (!isSelected && tooltip.selectedNode === flamegraphItem) { tooltip.selectedNode = null; } } + function checkBindingLoop(otherTypeId) { + if (typeId === otherTypeId) { + isBindingLoop = true; + return true; + } else { + return parent.checkBindingLoop(otherTypeId); + } + } + function details() { var model = []; function addDetail(name, index, format) { @@ -129,11 +142,21 @@ ScrollView { return flamegraph.blue2; else if (tooltip.hoveredNode === flamegraphItem) return flamegraph.blue1; + else if (flamegraphItem.note() !== "" || flamegraphItem.isBindingLoop) + return flamegraph.orange; else - return flamegraph.grey1 + return flamegraph.grey1; + } + border.width: { + if (tooltip.hoveredNode === flamegraphItem || + tooltip.selectedNode === flamegraphItem) { + return 2; + } else if (flamegraphItem.note() !== "") { + return 3; + } else { + return 1; + } } - border.width: (tooltip.hoveredNode === flamegraphItem || - tooltip.selectedNode === flamegraphItem) ? 2 : 1 color: Qt.hsla((level % 12) / 72, 0.9 + Math.random() / 10, 0.45 + Math.random() / 10, 0.9 + Math.random() / 10); height: flamegraphItem.rangeTypeVisible ? flamegraph.itemHeight : 0; diff --git a/src/plugins/qmlprofilerextension/flamegraphmodel.cpp b/src/plugins/qmlprofilerextension/flamegraphmodel.cpp index e181a66109d..f759f2a8152 100644 --- a/src/plugins/qmlprofilerextension/flamegraphmodel.cpp +++ b/src/plugins/qmlprofilerextension/flamegraphmodel.cpp @@ -96,24 +96,8 @@ void FlameGraphModel::loadNotes(int typeIndex, bool emitSignal) m_typeIdsWithNotes.insert(typeIndex); } - if (!emitSignal) - return; - - QQueue queue; - queue.append(QModelIndex()); - - QVector roles = {Note}; - while (!queue.isEmpty()) { - QModelIndex index = queue.takeFirst(); - if (index.isValid()) { - FlameGraphData *data = static_cast(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() << 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; }