QmlProfiler: Show note indication in category labels

Change-Id: I9bcb9bcaab6d24c87c932fce610a6026461a5ecb
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2014-09-26 15:40:11 +02:00
parent a466a3eb55
commit bac3b888fc
3 changed files with 43 additions and 0 deletions

View File

@@ -193,6 +193,48 @@ Item {
}
}
ToolButton {
id: notesButton
anchors.verticalCenter: txt.verticalCenter
anchors.right: expandButton.left
implicitWidth: 17
implicitHeight: txt.height - 1
property var eventIds: []
property var texts: []
property int currentNote: -1
Connections {
target: qmlProfilerModelProxy
onModelsChanged: notesButton.updateNotes()
onNotesChanged: {
if (arguments[1] === -1 || arguments[1] === modelIndex)
notesButton.updateNotes();
}
}
function updateNotes() {
var notes = qmlProfilerModelProxy.notesByTimelineModel(modelIndex);
var newTexts = [];
var newEventIds = [];
for (var i in notes) {
newTexts.push(qmlProfilerModelProxy.noteText(notes[i]))
newEventIds.push(qmlProfilerModelProxy.noteTimelineIndex(notes[i]));
}
// Bindings are only triggered when assigning the whole array.
eventIds = newEventIds;
texts = newTexts;
}
visible: eventIds.length > 0
iconSource: "ico_note.png"
tooltip: texts.join("\n");
onClicked: {
if (++currentNote >= eventIds.length)
currentNote = 0;
view.selectFromEventIndex(modelIndex, eventIds[currentNote]);
}
}
ToolButton {
id: expandButton
anchors.verticalCenter: txt.verticalCenter

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

View File

@@ -27,6 +27,7 @@
<file>ico_next.png</file>
<file>ico_rangeselection.png</file>
<file>ico_rangeselected.png</file>
<file>ico_note.png</file>
<file>ButtonsBar.qml</file>
<file>ico_filter.png</file>
</qresource>