diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-06-18 11:20:41 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-06-24 14:50:02 +0200 |
commit | 63ca524069da8c78f5925bb2b713f13bb799025b (patch) | |
tree | 52d569d37f1ad2e5a7853c2829f3297e91035af2 /src/plugins/qmlprofiler/qml/TimeMarks.qml | |
parent | d1cd1a490c30850a51f4e8c21b549f50682328a4 (diff) | |
download | qt-creator-63ca524069da8c78f5925bb2b713f13bb799025b.tar.gz |
QmlProfiler: Put height of rows in the timeline into the model
Like that we can provide functionality to interactively resize rows in
the model so that one can zoom in to more interesting parts.
Change-Id: I31f14cd8aa37703240ebec744ca2e77188fb0f27
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/plugins/qmlprofiler/qml/TimeMarks.qml')
-rw-r--r-- | src/plugins/qmlprofiler/qml/TimeMarks.qml | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/plugins/qmlprofiler/qml/TimeMarks.qml b/src/plugins/qmlprofiler/qml/TimeMarks.qml index b482023fd5..a2e2d49bc2 100644 --- a/src/plugins/qmlprofiler/qml/TimeMarks.qml +++ b/src/plugins/qmlprofiler/qml/TimeMarks.qml @@ -102,21 +102,30 @@ Canvas { function drawBackgroundBars( context, region ) { var colorIndex = true; - // row background - var backgroundOffset = y < 0 ? -y : -(y % (2 * root.singleRowHeight)); - for (var currentY= backgroundOffset; currentY < Math.min(height, labels.height - y); currentY += root.singleRowHeight) { - context.fillStyle = colorIndex ? "#f0f0f0" : "white"; - context.strokeStyle = colorIndex ? "#f0f0f0" : "white"; - context.fillRect(0, currentY, width, root.singleRowHeight); - colorIndex = !colorIndex; - } - // separators - var cumulatedHeight = 0; - for (var modelIndex = 0; modelIndex < qmlProfilerModelProxy.modelCount() && cumulatedHeight < y + height; modelIndex++) { - cumulatedHeight += root.singleRowHeight * qmlProfilerModelProxy.rowCount(modelIndex); - if (cumulatedHeight < y) + var cumulatedHeight = y < 0 ? -y : 0; + for (var modelIndex = 0; modelIndex < qmlProfilerModelProxy.modelCount(); ++modelIndex) { + var modelHeight = qmlProfilerModelProxy.height(modelIndex); + if (cumulatedHeight + modelHeight < y) { + cumulatedHeight += modelHeight; + if (qmlProfilerModelProxy.rowCount(modelIndex) % 2 !== 0) + colorIndex = !colorIndex; continue; + } + + for (var row = 0; row < qmlProfilerModelProxy.rowCount(modelIndex); ++row) { + // row background + var rowHeight = qmlProfilerModelProxy.rowHeight(modelIndex, row) + cumulatedHeight += rowHeight; + colorIndex = !colorIndex; + if (cumulatedHeight < y - rowHeight) + continue; + context.strokeStyle = context.fillStyle = colorIndex ? "#f0f0f0" : "white"; + context.fillRect(0, cumulatedHeight - rowHeight - y, width, rowHeight); + + if (cumulatedHeight > y + height) + return; + } context.strokeStyle = "#B0B0B0"; context.beginPath(); |