From 71763310ad46f68e3acf5eaa58b61d9ada22df1e Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Thu, 3 Nov 2011 16:15:50 +0100 Subject: [PATCH] QmlProfiler: center event on clicked in details Change-Id: I6e81089b3014f15545be4c40e0909ff2a37dbe1b Reviewed-by: Kai Koehne --- src/plugins/qmlprofiler/qml/MainView.qml | 8 ++++++++ src/plugins/qmlprofiler/qml/RangeDetails.qml | 1 + 2 files changed, 9 insertions(+) diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml index adf61d2325f..46bcfb4a045 100644 --- a/src/plugins/qmlprofiler/qml/MainView.qml +++ b/src/plugins/qmlprofiler/qml/MainView.qml @@ -218,6 +218,14 @@ Rectangle { zoomControl.setRange(newStart, newStart + windowLength); } + function recenterOnItem( itemIndex ) + { + // if item is outside of the view, jump back to its position + if (qmlEventList.getEndTime(itemIndex) < view.startTime || qmlEventList.getStartTime(itemIndex) > view.endTime) { + recenter((qmlEventList.getStartTime(itemIndex) + qmlEventList.getEndTime(itemIndex)) / 2); + } + } + function globalZoom() { zoomControl.setRange(qmlEventList.traceStartTime(), qmlEventList.traceEndTime()); } diff --git a/src/plugins/qmlprofiler/qml/RangeDetails.qml b/src/plugins/qmlprofiler/qml/RangeDetails.qml index 0b3b58d7f0e..b394081be2b 100644 --- a/src/plugins/qmlprofiler/qml/RangeDetails.qml +++ b/src/plugins/qmlprofiler/qml/RangeDetails.qml @@ -113,6 +113,7 @@ BorderImage { drag.target: parent onClicked: { root.gotoSourceLocation(file, line); + root.recenterOnItem(view.selectedItem); } }