forked from qt-creator/qt-creator
FlameGraph: Allow zooming into items
Double clicking an item will now rebuild the flame graph with that item as root. Double clicking on an empty area will reset the root. Change-Id: I16dd4b00d0dd09ff922a01acee67f0d553da6323 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -58,8 +58,21 @@ ScrollView {
|
||||
contentHeight: flamegraph.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
tooltip.selectedNode = null;
|
||||
flameGraphModel.typeSelected(-1);
|
||||
}
|
||||
onDoubleClicked: {
|
||||
tooltip.selectedNode = null;
|
||||
flameGraphModel.typeSelected(-1);
|
||||
flamegraph.resetRoot();
|
||||
}
|
||||
}
|
||||
|
||||
FlameGraph {
|
||||
property int delegateHeight: Math.max(30, flickable.height / depth)
|
||||
property int delegateHeight: Math.min(60, Math.max(30, flickable.height / depth))
|
||||
property color blue: "blue"
|
||||
property color blue1: Qt.lighter(blue)
|
||||
property color blue2: Qt.rgba(0.375, 0, 1, 1)
|
||||
@@ -71,7 +84,7 @@ ScrollView {
|
||||
|
||||
id: flamegraph
|
||||
width: parent.width
|
||||
height: depth * delegateHeight
|
||||
height: Math.max(depth * delegateHeight, flickable.height)
|
||||
model: flameGraphModel
|
||||
sizeRole: root.sizeRole
|
||||
sizeThreshold: 0.002
|
||||
@@ -135,7 +148,7 @@ ScrollView {
|
||||
+ Math.floor(width / flamegraph.width * 1000) / 10 + "%)";
|
||||
}
|
||||
text: textVisible ? buildText() : ""
|
||||
FlameGraph.onDataChanged: if (textVisible) text = buildText();
|
||||
FlameGraph.onModelIndexChanged: if (textVisible) text = buildText();
|
||||
|
||||
onMouseEntered: {
|
||||
tooltip.hoveredNode = flamegraphItem;
|
||||
@@ -152,7 +165,7 @@ ScrollView {
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
function selectClicked() {
|
||||
if (flamegraphItem.FlameGraph.dataValid) {
|
||||
tooltip.selectedNode = flamegraphItem;
|
||||
flameGraphModel.typeSelected(flamegraphItem.FlameGraph.data(
|
||||
@@ -167,6 +180,12 @@ ScrollView {
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: selectClicked()
|
||||
onDoubleClicked: {
|
||||
selectClicked();
|
||||
flamegraph.root = FlameGraph.modelIndex;
|
||||
}
|
||||
|
||||
// Functions, not properties to limit the initial overhead when creating the nodes,
|
||||
// and because FlameGraph.data(...) cannot be notified anyway.
|
||||
function title() { return FlameGraph.data(QmlProfilerFlameGraphModel.TypeRole) || ""; }
|
||||
|
||||
Reference in New Issue
Block a user