Commit bb517a64 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Show notes in overview

Change-Id: Ie24c2c01a978640bd2925265385ff7c7b3274a41
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent bac3b888
......@@ -91,7 +91,39 @@ function drawBindingLoops(canvas, ctxt) {
}
}
}
}
function drawNotes(canvas, ctxt)
{
if ((!qmlProfilerModelProxy) || qmlProfilerModelProxy.noteCount() === 0)
return;
var spacing = canvas.width / qmlProfilerModelProxy.traceDuration();
// divide canvas height in 7 parts: margin, 3*line, space, dot, margin
var vertSpace = (canvas.height - canvas.bump) / 7;
ctxt.strokeStyle = "orange";
ctxt.lineWidth = 2;
for (var i = 0; i < qmlProfilerModelProxy.noteCount(); ++i) {
var timelineModel = qmlProfilerModelProxy.noteTimelineModel(i);
var timelineIndex = qmlProfilerModelProxy.noteTimelineIndex(i);
if (timelineIndex === -1)
continue;
var traceStart = qmlProfilerModelProxy.traceStartTime();
var traceEnd = qmlProfilerModelProxy.traceEndTime();
var start = Math.max(qmlProfilerModelProxy.startTime(timelineModel, timelineIndex),
traceStart);
var end = Math.min(qmlProfilerModelProxy.endTime(timelineModel, timelineIndex),
traceEnd);
var annoX = Math.round(((start + end) / 2 - traceStart) * spacing);
ctxt.moveTo(annoX, canvas.bump + vertSpace)
ctxt.lineTo(annoX, canvas.bump + vertSpace * 4)
ctxt.stroke();
ctxt.moveTo(annoX, canvas.bump + vertSpace * 5);
ctxt.lineTo(annoX, canvas.bump + vertSpace * 6);
ctxt.stroke();
}
}
function drawTimeBar(canvas, ctxt)
......
......@@ -107,6 +107,7 @@ Canvas {
offset = -1;
requestPaint();
}
onNotesChanged: notes.doPaint = true;
}
Timer {
......@@ -137,10 +138,31 @@ Canvas {
Plotter.drawBindingLoops(canvas, context);
++offset;
} else {
notes.doPaint = true;
offset = -1;
}
}
Canvas {
property alias bump: canvas.bump
property bool doPaint: false
onDoPaintChanged: {
if (doPaint)
requestPaint();
}
id: notes
anchors.fill: parent
onPaint: {
if (doPaint) {
var context = (notes.context === null) ? getContext("2d") : notes.context;
context.reset();
Plotter.drawNotes(notes, context);
doPaint = false;
}
}
}
// ***** child items
MouseArea {
anchors.fill: canvas
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment