QmlProfiler: Consistently clear when clear button pressed

Several QML properties need extra treatment to avoid stale data
after clearing. Toggling the visibility of the timeline renderer
doesn't really help there.

Task-number: QTCREATORBUG-11833

Change-Id: I1903d7bd69d6fe31ecc4cadca8e30fa2104fa09a
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-03-25 17:10:25 +01:00
parent 85b7d34ea8
commit 0c9a9348f9
6 changed files with 24 additions and 26 deletions

View File

@@ -37,7 +37,6 @@ Canvas {
property real startTime : 0
property real endTime : 0
property real timePerPixel: 0
Connections {
target: zoomControl
@@ -55,7 +54,7 @@ Canvas {
context.fillRect(0, 0, width, height);
var realWidth = width - 1; // account for left border
var totalTime = endTime - startTime;
var totalTime = Math.max(1, endTime - startTime);
var spacing = realWidth / totalTime;
var initialBlockLength = 120;
@@ -67,7 +66,7 @@ Canvas {
var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock;
var realStartPos = (startTime - realStartTime) * spacing - 1;
timePerPixel = timePerBlock/pixelsPerBlock;
var timePerPixel = timePerBlock/pixelsPerBlock;
var initialColor = Math.floor(realStartTime/timePerBlock) % 2;
@@ -100,6 +99,12 @@ Canvas {
context.fillRect(0, 0, 1, height);
}
function clear()
{
startTime = endTime = 0;
requestPaint();
}
function prettyPrintTime( t )
{
var round = 1;