forked from qt-creator/qt-creator
QmlProfiler: Show note indication in category labels
Change-Id: I9bcb9bcaab6d24c87c932fce610a6026461a5ecb Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
@@ -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
|
||||
|
||||
BIN
src/plugins/qmlprofiler/qml/ico_note.png
Normal file
BIN
src/plugins/qmlprofiler/qml/ico_note.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 117 B |
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user