aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristiaan Janssen <christiaan.janssen@digia.com>2013-06-13 14:10:45 +0200
committerKai Koehne <kai.koehne@digia.com>2013-06-13 15:18:59 +0300
commit1068b288f657051a22ba00ea8c31856423cb7162 (patch)
treef425b80cafed6ce77ac137f18704a31d481c67c1
parent0e6180a7e4e4208a09dc87f7ad7f1a7b408985a6 (diff)
QmlProfiler: fix zoom when item selected
Change-Id: If00ed1510386d64f4672ee23eaef5575e784c605 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r--plugins/qmlprofiler/qml/MainView.qml20
-rw-r--r--plugins/qmlprofiler/qml/RangeDetails.qml2
-rw-r--r--plugins/qmlprofiler/timelinemodelaggregator.cpp9
-rw-r--r--plugins/qmlprofiler/timelinemodelaggregator.h2
4 files changed, 23 insertions, 10 deletions
diff --git a/plugins/qmlprofiler/qml/MainView.qml b/plugins/qmlprofiler/qml/MainView.qml
index f1420d3be5..849d22b8b7 100644
--- a/plugins/qmlprofiler/qml/MainView.qml
+++ b/plugins/qmlprofiler/qml/MainView.qml
@@ -216,7 +216,7 @@ Rectangle {
if (view.selectedItem !== -1) {
// center on selected item if it's inside the current screen
- var newFixedPoint = qmlProfilerModelProxy.getStartTime(view.selectedItem);
+ var newFixedPoint = qmlProfilerModelProxy.getStartTime(view.selectedModel, view.selectedItem);
if (newFixedPoint >= view.startTime && newFixedPoint < view.endTime)
fixedPoint = newFixedPoint;
}
@@ -258,16 +258,16 @@ Rectangle {
zoomControl.setRange(newStart, newStart + windowLength);
}
- function recenterOnItem( itemIndex )
+ function recenterOnItem( modelIndex, itemIndex )
{
if (itemIndex === -1)
return;
// if item is outside of the view, jump back to its position
- if (qmlProfilerModelProxy.getEndTime(itemIndex) < view.startTime ||
- qmlProfilerModelProxy.getStartTime(itemIndex) > view.endTime) {
- recenter((qmlProfilerModelProxy.getStartTime(itemIndex) +
- qmlProfilerModelProxy.getEndTime(itemIndex)) / 2);
+ if (qmlProfilerModelProxy.getEndTime(modelIndex, itemIndex) < view.startTime ||
+ qmlProfilerModelProxy.getStartTime(modelIndex, itemIndex) > view.endTime) {
+ recenter((qmlProfilerModelProxy.getStartTime(modelIndex, itemIndex) +
+ qmlProfilerModelProxy.getEndTime(modelIndex, itemIndex)) / 2);
}
}
@@ -295,15 +295,19 @@ Rectangle {
function selectNextWithId( eventId )
{
+ // this is a slot responding to events from the other pane
+ // which tracks only events from the basic model
if (!lockItemSelection) {
lockItemSelection = true;
var itemIndex = view.nextItemFromId( eventId );
+ var modelIndex = qmlProfilerModelProxy.basicModelIndex();
// select an item, lock to it, and recenter if necessary
- if (view.selectedItem != itemIndex) {
+ if (view.selectedItem != itemIndex || view.selectedModel != modelIndex) {
+ view.selectedModel = modelIndex;
view.selectedItem = itemIndex;
if (itemIndex !== -1) {
view.selectionLocked = true;
- recenterOnItem(itemIndex);
+ recenterOnItem(modelIndex, itemIndex);
}
}
lockItemSelection = false;
diff --git a/plugins/qmlprofiler/qml/RangeDetails.qml b/plugins/qmlprofiler/qml/RangeDetails.qml
index c066b06bde..a0fb3e8d77 100644
--- a/plugins/qmlprofiler/qml/RangeDetails.qml
+++ b/plugins/qmlprofiler/qml/RangeDetails.qml
@@ -196,7 +196,7 @@ Item {
drag.maximumY: root.candidateHeight - parent.height + yoffset
onClicked: {
root.gotoSourceLocation(file, line, column);
- root.recenterOnItem(view.selectedItem);
+ root.recenterOnItem(view.selectedModel, view.selectedItem);
}
}
diff --git a/plugins/qmlprofiler/timelinemodelaggregator.cpp b/plugins/qmlprofiler/timelinemodelaggregator.cpp
index 99c284aea8..238a7a0f3a 100644
--- a/plugins/qmlprofiler/timelinemodelaggregator.cpp
+++ b/plugins/qmlprofiler/timelinemodelaggregator.cpp
@@ -47,6 +47,7 @@ public:
TimelineModelAggregator *q;
+ int basicModelIndex;
QList <AbstractTimelineModel *> modelList;
QmlProfilerModelManager *modelManager;
};
@@ -82,7 +83,8 @@ void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelMana
BasicTimelineModel *basicTimelineModel = new BasicTimelineModel(this);
basicTimelineModel->setModelManager(modelManager);
addModel(basicTimelineModel);
-
+ // the basic model is the last one here
+ d->basicModelIndex = d->modelList.count() - 1;
}
@@ -145,6 +147,11 @@ bool TimelineModelAggregator::eventAccepted(const QmlProfilerSimpleModel::QmlEve
return true;
}
+int TimelineModelAggregator::basicModelIndex() const
+{
+ return d->basicModelIndex;
+}
+
qint64 TimelineModelAggregator::lastTimeMark() const
{
qint64 mark = -1;
diff --git a/plugins/qmlprofiler/timelinemodelaggregator.h b/plugins/qmlprofiler/timelinemodelaggregator.h
index 4f650bb4a5..c0fa1d92b4 100644
--- a/plugins/qmlprofiler/timelinemodelaggregator.h
+++ b/plugins/qmlprofiler/timelinemodelaggregator.h
@@ -63,6 +63,8 @@ public:
bool eventAccepted(const QmlProfilerSimpleModel::QmlEventData &event) const;
+ Q_INVOKABLE int basicModelIndex() const;
+
Q_INVOKABLE qint64 lastTimeMark() const;
Q_INVOKABLE void setExpanded(int modelIndex, int category, bool expanded);