Commit 24c99047 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Prefer events with notes when propagating selections

If you click on a row with a note in the timeline you probably want to
see the place with the note, not some other occurrence of the event
type.

Change-Id: Ic94514e460a33dbadca5cfed0b1455a1718b6d03
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent 9331565e
......@@ -161,7 +161,19 @@ Rectangle {
// which tracks only events from the basic model
if (!lockItemSelection) {
lockItemSelection = true;
var itemIndex = view.nextItemFromSelectionId(modelIndex, selectionId);
var itemIndex = -1;
var notes = qmlProfilerModelProxy.notesByTypeId(selectionId);
if (notes.length !== 0) {
itemIndex = qmlProfilerModelProxy.noteTimelineIndex(notes[0]);
// for some models typeId != selectionId. In that case we cannot select the noted
// events. This is purely theoretical as their data doesn't show up in the events
// view so that we cannot receive a selection event for them.
if (qmlProfilerModelProxy.typeId(modelIndex, itemIndex) !== selectionId)
itemIndex = -1;
}
if (itemIndex === -1)
itemIndex = view.nextItemFromSelectionId(modelIndex, selectionId);
// select an item, lock to it, and recenter if necessary
view.selectFromEventIndex(modelIndex, itemIndex); // triggers recentering
if (itemIndex !== -1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment