forked from qt-creator/qt-creator
		
	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: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user