QmlProfiler: Center trace view vertically around newly selected items

It's rather unintuitive if it only centers horizontally.

Change-Id: I9245da0b26fccc14a100804715d09aaa82059413
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-09-29 16:49:31 +02:00
parent 95a13d57c8
commit 0f3f3df36c
3 changed files with 17 additions and 4 deletions

View File

@@ -141,6 +141,13 @@ Rectangle {
recenter((qmlProfilerModelProxy.startTime(modelIndex, itemIndex) +
qmlProfilerModelProxy.endTime(modelIndex, itemIndex)) / 2);
}
var row = qmlProfilerModelProxy.row(modelIndex, itemIndex);
var totalRowOffset = qmlProfilerModelProxy.modelOffset(modelIndex) +
qmlProfilerModelProxy.rowOffset(modelIndex, row);
if (totalRowOffset > flick.contentY + flick.height ||
totalRowOffset + qmlProfilerModelProxy.rowHeight(modelIndex, row) < flick.contentY)
flick.contentY = Math.min(flick.contentHeight - flick.height,
Math.max(0, totalRowOffset - flick.height / 2));
}
function hideRangeDetails() {